Re: Why am I always getting the linker error: 'duplicate symbol'...?
Re: Why am I always getting the linker error: 'duplicate symbol'...?
- Subject: Re: Why am I always getting the linker error: 'duplicate symbol'...?
- From: Jens Alfke <email@hidden>
- Date: Mon, 21 Sep 2009 14:27:11 -0700
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 (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