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

From: George (greerga@CIRCLEMUD.ORG)
Date: 12/20/97


On Fri, 19 Dec 1997, Daniel Koepke wrote:

>but, this isn't:
>
>  switch (i) {
>  case 'a':
>    break;
>  default:
>    return 0;
>  }

Ok, I'll bite.

greerga@bacon:~/c$ cat switch.c
#include <stdio.h>
int main(void)
{
  int i = 5;
  switch (i) {
  case 'a':
    break;
  default:
    return 0;
  }
  return 0;
}
greerga@bacon:~/c$ gcc -Wall switch.c
greerga@bacon:~/c$ gcc -Wall switch.c -o switch
greerga@bacon:~/c$ ./switch
greerga@bacon:~/c$ egcs switch.c
greerga@bacon:~/c$ egcs -Wall switch.c -o switch
greerga@bacon:~/c$ ./switch
greerga@bacon:~/c$

No warnings, errors, and runs fine...?

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | 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