home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / sgi / 18025 < prev    next >
Encoding:
Text File  |  1992-12-15  |  1.6 KB  |  59 lines

  1. Newsgroups: comp.sys.sgi
  2. Path: sparky!uunet!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!Chico.Chemie.FU-Berlin.DE!melchers
  3. From: melchers@Chico.Chemie.FU-Berlin.DE (Bernd Melchers)
  4. Subject: cpp-error?
  5. Message-ID: <LIU9YF@math.fu-berlin.de>
  6. Summary: incorrect evaluation of #if...#elif...#else...#endif statement
  7. Sender: news@math.fu-berlin.de (Math Department)
  8. Organization: Free University of Berlin, Germany
  9. Date: Tue, 15 Dec 1992 12:56:32 GMT
  10. Lines: 47
  11.  
  12. Is there an error in silicon graphics (mips) preprosessor ?
  13. The preprocessor evaluates the following file as below
  14.  
  15. $> cat sgi.c
  16.  
  17. #define SHIFT 0
  18. #define CSWITCH 1
  19. #define RSWITCH 0
  20.  
  21. #if SHIFT
  22.        shift valid (SHIFT)
  23. #elif CSWITCH
  24.        cswitch valid (CSWITCH)
  25. #elif RSWITCH
  26.        rswitch valid (RSWITCH)
  27. #else
  28.        nothing valid (SHIFT CSWITCH RSWITCH)
  29. #endif
  30.  
  31. $> cc -P sgi.c; cat sgi.i
  32.  
  33.  
  34.  
  35.        cswitch valid (1)
  36.  
  37.        nothing valid (0 1 0)
  38. whereas the gnu compiler ( as many other) says
  39.  
  40. $> gcc -E sgi.c
  41.  
  42.  
  43.           cswitch valid (1)
  44.  
  45. Who is wrong ?
  46.  
  47. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  48. Bernd Melchers                   | melchers@chico.chemie.fu-berlin.de
  49. Freie Universitaet Berlin        | Lieblingsessen: Pizza, aber nur
  50. Institut fuer Kristallographie   |              selbstgemachte...
  51. Takustr. 6                       |              und ohne Tierkadaver
  52. D 1000 Berlin 33                 |
  53. Earth                            |
  54. Tel.: 0049-30-8383612            |
  55.                                  |
  56. Please replace battery pack, attach external power,
  57. or system will be shutdown in 10 seconds.
  58. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  59.