Re: Mixing ObjC and C++ STL on same ObjC source file
Re: Mixing ObjC and C++ STL on same ObjC source file
- Subject: Re: Mixing ObjC and C++ STL on same ObjC source file
- From: Bill Royds <email@hidden>
- Date: Sat, 13 Sep 2008 10:17:13 -0400
On 13-Sep-08, at 07:45 , Daniel Luis dos Santos wrote:
That said, STL can be used only within a library's own code. Then
when coding a shared library one must implement all kinds of data
structures that can be used at the boundary. Isn't that like
reinventing the wheel ?
Yes. But that is what C was designed for. It was created as a systems
implementation language, not a general purpose one. The idea was to
have a minimal language without the overhead of anything that was not
part of the computer hardware. That is why even I/O is part of a
library added on, not part of the language syntax.
Having to implement those data structures is a lot of work (at least
for who's beginning to write C code). Having to do a map
implementation or a linked list is almost like starting from
scratch. Is there any implementation of those standardized in the C
world (that is only C and portable) ?
No, since the structures used in a linked list or a map depend on that
data being used and that can not be determined by a subroutine. IT
requires the concept of templates that is not part of the C language.
C is designed to be lean and efficient, not bloated with huge numbers
of libraries.
Objective C itself adds relatively little to the C language to achieve
a very powerful object-oriented superset. That is where your map
implementation exists (NSDictionary, for example) without making the
language bloated.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden