home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / gnu / gcc / help / 3038 < prev    next >
Encoding:
Internet Message Format  |  1993-01-27  |  1.9 KB

  1. Path: sparky!uunet!uunet.ca!canrem!telly!utzoo!torn!cs.utexas.edu!sdd.hp.com!spool.mu.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!osf.ORG!meissner
  2. From: meissner@osf.ORG
  3. Newsgroups: gnu.gcc.help
  4. Subject: unterminated character constant
  5. Date: 27 Jan 1993 09:37:35 -0500
  6. Organization: GNUs Not Usenet
  7. Lines: 42
  8. Sender: daemon@cis.ohio-state.edu
  9. Distribution: gnu
  10. Message-ID: <9301271435.AA05272@tiktok.osf.org>
  11. References: meissner@osf.ORG
  12.  
  13. | Compiling the following code segment (no compiler options):
  14. |     #if 0
  15. |        This is a test of an if
  16. |        This line isn't going to work
  17. |        But this line will, as will the first line
  18. |     #endif
  19. | with GCC 2.3.3 under Linux 0.99pl3 (i486), SunOs 4.1.1 (Sparc), and
  20. | Ultrix 4.2 (DEC 5000) yields an the error:
  21. |     a.c:3: unterminated character constant
  22. | The problem is the single quote.  It also happens if you use an #ifdef,
  23. | but doesn't happen if you put the text inside a comment.
  24.  
  25. This is not a bug.  ANSI requires that tokenization occur before
  26. #ifdef processing, in order to describe #ifdef processing in any
  27. reasonable fashion.
  28.  
  29. In fact, the fine manual says (in the incompatibilities section):
  30.  
  31.    * GNU CC complains about unterminated character constants inside of
  32.      preprocessor conditionals that fail.  Some programs have English
  33.      comments enclosed in conditionals that are guaranteed to fail; if
  34.      these comments contain apostrophes, GNU CC will probably report an
  35.      error.  For example, this code would produce an error:
  36.  
  37.           #if 0
  38.           You can't expect this to work.
  39.           #endif
  40.  
  41.      The best solution to such a problem is to put the text into an
  42.      actual C comment delimited by `/*...*/'.  However, `-traditional'
  43.      suppresses these error messages.
  44.  
  45.  
  46. --
  47. Michael Meissner    email: meissner@osf.org        phone: 617-621-8861
  48. Open Software Foundation, 11 Cambridge Center, Cambridge, MA, 02142
  49.  
  50. You are in a twisty little passage of standards, all conflicting.
  51.