Re: [OFF-TOPIC] question about switch, return, break

From: Sean butler (sbutler@DEVEAST.COM)
Date: 12/19/97


>> break is not needed in a switch statement.
>
>That is absolutely, unequivacally *NOT* true for ANSI C compatible
>compilers.  'break' is required.  If you want to test it, just
>type in a switch() statement that has no 'break's and see what the
>compiler tells you.
>
>
>daniel koepke / dkoepke@california.com
>

I am sorry Daniel, but you are simply wrong.  Try it for yourself.
Compile this with gcc:

#include <stdio.h>

main()
{
    int i = 10;

    switch (i) {
      case 1:
      case 2:
      case 3:
      case 4:
      default:
        printf("Sean is right!");
   }
}


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST