Re: Bug in Debugger?
Re: Bug in Debugger?
- Subject: Re: Bug in Debugger?
- From: Howard Moon <email@hidden>
- Date: Thu, 30 Apr 2009 08:41:42 -0700
On Apr 30, 2009, at 7:58 AM, Olivier Tristan wrote:
You're looking for trouble if you don't initialise your first enum.
enum {Lat1 = 0, Lon0, Lat0, Lon1};
Otherwise it may not be 0 if you have other enums in the same file.
My 2 cents.
I'm pretty sure that's not correct. The C++ standard dictates that
for any given enum statement, the value of the first enumerator
(i.e., Lat1, in this case) is 0 unless explicitly assigned a constant
value. Whether there are other enum statements in the same "file" is
irrelevant. While each subsequent enumerator (in a given enum
statement) is assigned the value of the previous enumerator plus 1
(unless a constant is assigned to it), this pattern does not carry
over from previous enum statements. The first enumerator means the
first enumerator in that enum statement, not the first in the
"file". So if you have ten enum statements, then each one will start
with the constant value 0 (unless explicitly assigned a different
value). They do not start with 1 more than the last enumerator in
some earlier enum statement.
-Howard
_______________________________________________
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