On 27 Nov 2009, at 11:35, John Love wrote:
>
> I get "Initializer element is not constant. This pertains to the NSString*
> because if I directly substitute the following, no compile error happens:
> YearAmt gTest[] = {{@"testy", 10}
>
> What fundamental pertaining to C or C++ am I not getting?
You can't have non constant elements in struct initialisers, testy is not a
constant. The error message spells out exactly what the issue is.
This is not, by the way, an NSString specific issue. The following gives the
same error
typedef struct Foo
{
int foo;
} Foo;
int anInt = 6;
Foo fooArray[] = {{ anInt }};
Use of the "const" keyword doesn't help.
>
>
> John Love
> Touch the Future! Teach!
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list ([email protected])
>
> 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/adc%40jeremyp.net
>
> This email sent to [email protected]
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_______________________________________________
Cocoa-dev mailing list ([email protected])
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 [email protected]