Re: Case label does not reduce to an integer constant . . .
Re: Case label does not reduce to an integer constant . . .
- Subject: Re: Case label does not reduce to an integer constant . . .
- From: "Michael A. Crawford" <email@hidden>
- Date: Mon, 08 Feb 2010 11:49:19 -0500
So this is a difference between C and C++, then. Ok, I can live with that. I'll switch to enums.
-Michael On Feb 8, 2010, at 11:46 AM, Jens Alfke wrote: On Feb 8, 2010, at 7:59 AM, Michael A. Crawford wrote: static NSUInteger const kGPSSettingsRowIndex = 0;
In C, integer constants like this are a little bit broken. They get treated as full-fledged integer variables whose values can't be changed, rather than compile-time constants. In most cases this seems to work out OK, except that the linker allocates spaces for the variable, but it sounds like you've hit a case where the optimizer doesn't constant-fold the _expression_ and decides it isn't a valid case label.
Using a #define or an enum is more reliable in C.
—Jens
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden