On Sep 21, 2009, at 2:15 PM, Frederick C. Lee wrote:
I'm assuming 'const <datatype>' is better then the compiler
directive '#define', due to the use of the compiler
for more-efficient code. Hence the attempt.
It depends. In C, a const variable of a primitive type like an integer
is less efficient than a #define. The problem is that it ends up being
treated as a regular global variable (except its value can't be
changed). In C++, though, const primitives are optimized away just as
a #define would be, and can be declared without an 'extern' in a header.
(If you want, you can get the C++ semantics by using Objective-C++,
i.e. changing the suffix of your source files to .mm.)
—Jens_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to arch...@mail-archive.com