tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: enumeration of bicycle sheds
On Thu, Feb 18, 2010 at 7:18 AM, Iain Hibbert <plunky%rya-online.net@localhost>
wrote:
> On Thu, 18 Feb 2010, Terry Moore wrote:
>
>> Looking at C99, trailing commas _are_ allowed in enum lists.
>
> I know that, but C89 expressly forbade it and apparently C++ is similar.
> I'm not claiming that its reasonable and incidentally, share/misc/style
> says to not use the comma..
>
> If you or anybody wants to argue for or against enum vs #define for lists
> of internal state variables, please go ahead. If the type checking for
> enum was strong enough that
>
> enum val { FOO, BAR };
> int v = FOO;
>
> or
>
> enum val { FOO, BAR };
> enum val v = 3;
>
> actually caused warnings then I would be more inclined to use it. In the
> meantime, I generally prefer #define but am not greatly attached.
>
Debugging anything which uses #define is a major pita. That's why
people went to this and things like static const variables instead.
James
Home |
Main Index |
Thread Index |
Old Index