Akim Demaille <[EMAIL PROTECTED]> 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.


Reply via email to