home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.sgi
- Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!Chico.Chemie.FU-Berlin.DE!melchers
- From: melchers@Chico.Chemie.FU-Berlin.DE (Bernd Melchers)
- Subject: cpp-error?
- Message-ID: <LIU9YF@math.fu-berlin.de>
- Summary: incorrect evaluation of #if...#elif...#else...#endif statement
- Sender: news@math.fu-berlin.de (Math Department)
- Organization: Free University of Berlin, Germany
- Date: Tue, 15 Dec 1992 12:56:32 GMT
- Lines: 47
-
- Is there an error in silicon graphics (mips) preprosessor ?
- The preprocessor evaluates the following file as below
-
- $> cat sgi.c
-
- #define SHIFT 0
- #define CSWITCH 1
- #define RSWITCH 0
-
- #if SHIFT
- shift valid (SHIFT)
- #elif CSWITCH
- cswitch valid (CSWITCH)
- #elif RSWITCH
- rswitch valid (RSWITCH)
- #else
- nothing valid (SHIFT CSWITCH RSWITCH)
- #endif
-
- $> cc -P sgi.c; cat sgi.i
-
-
-
- cswitch valid (1)
-
- nothing valid (0 1 0)
- whereas the gnu compiler ( as many other) says
-
- $> gcc -E sgi.c
-
-
- cswitch valid (1)
-
- Who is wrong ?
-
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
- Bernd Melchers | melchers@chico.chemie.fu-berlin.de
- Freie Universitaet Berlin | Lieblingsessen: Pizza, aber nur
- Institut fuer Kristallographie | selbstgemachte...
- Takustr. 6 | und ohne Tierkadaver
- D 1000 Berlin 33 |
- Earth |
- Tel.: 0049-30-8383612 |
- |
- Please replace battery pack, attach external power,
- or system will be shutdown in 10 seconds.
- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-