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

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


On Fri, 19 Dec 1997, StormeRider wrote:

>>#include <stdio.h>
>>
>>main()
>>{
>>    int i = 10;
>>
>>    switch (i) {
>>      case 1:
>>      case 2:
>>      case 3:
>>      case 4:
>>      default:
>>        printf("Sean is right!");
>>   }
>>}
>>
>Ack, no \r\ns!! =) Interesting thread here tho on ANSI vs. gcc...

(ansi.c being the program above with a 'return 0;' statement and 'int
main()' instead.)
greerga@bacon:~/c$ gcc -pedantic -ansi -Wall ansi.c
greerga@bacon:~/c$ egcs -pedantic -ansi -Wall ansi.c
greerga@bacon:~/c$

GCC man page:
              The `-ansi' option does not cause non-ANSI programs
              to be rejected gratuitously.  For that, `-pedantic'
              is required in addition to `-ansi'.

       -pedantic
              Issue all the  warnings  demanded  by  strict  ANSI
              standard  C; reject all programs that use forbidden
              extensions.

Looks like ANSI code or two wrong compilers (albeit based on same source).

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