On 10/2/07, Arnaldo Carvalho de Melo <[EMAIL PROTECTED]> wrote:
> He used a "designated initializer", i.e. he said at which index in the
> array it the value is to be set. So it really doesn't matter the order.
> And when checking if the code was within the valid range he tested
> against the last entry in the enum. Correct code. :-)
>
> - Arnaldo
>
Yes you are correct. I misread the code.

However - I'd prefer another constant to match last in enum at the
same point as the declaration of the enum. This way if values are
added other code doesn't break. I've seen this done before quite a few
times. It is dangerous on relying on the last value when it's not
explicitly marked as the last value.

Ian
-- 
Web1: http://wand.net.nz/~iam4/
Web2: http://www.jandi.co.nz
Blog: http://iansblog.jandi.co.nz
-
To unsubscribe from this list: send the line "unsubscribe dccp" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to