c/2655: gcc 2.96 -ansi aborts on #if 0 // ' #endif

Zack Weinberg zackw@stanford.edu
Thu Apr 26 09:16:00 GMT 2001


The following reply was made to PR c/2655; it has been noted by GNATS.

From: "Zack Weinberg" <zackw@stanford.edu>
To: daniel@safelogic.se
Cc: gcc-gnats@gcc.gnu.org
Subject: Re: c/2655: gcc 2.96 -ansi aborts on #if 0 // ' #endif
Date: Thu, 26 Apr 2001 09:15:07 -0700

 On Thu, Apr 26, 2001 at 03:33:31PM -0000, daniel@safelogic.se wrote:
 > [daniel@fredrik Nuv-2]$ cat gccBug.c
 > #if 0
 > // '
 > #endif
 >  
 > int main(void)
 > {
 >   return 0;
 > }
 > [daniel@fredrik Nuv-2]$ gcc -ansi gccBug.c
 > gccBug.c:2:4: missing terminating ' character
 
 Not a bug.  -ansi means -std=c89, and // comments were not part of the
 1989 C standard.  The text between #if 0 and #endif (or any failed
 conditional block) must consist of complete preprocessing tokens; in
 particular, string and character constants must be closed.
 
 zw



More information about the Gcc-prs mailing list