[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison c++ compile
From: |
Paul Eggert |
Subject: |
Re: bison c++ compile |
Date: |
Sun, 22 Jan 2006 00:41:39 -0800 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
Akim Demaille <address@hidden> writes:
> That's nice, thanks! Just out of curiosity: why do you prefer
> "default:" first in the switches?
Older compilers don't know that 'abort ();' doesn't return, so if you
put the default last they might generate a bogus warning. E.g.:
int f (void)
{
switch (foo)
{
case 1: return 12;
case 2: return 22;
default: abort ();
}
}
An older compiler will warn you that f might return junk due to
falling out the end.
Putting the "default: abort ();" first pacifies these compilers.