standards/116346: FreeBSD has no conforming C implementation

Erik Trulsson ertr1013 at student.uu.se
Fri Sep 14 06:10:07 PDT 2007


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

From: Erik Trulsson <ertr1013 at student.uu.se>
To: Olaf Seibert <rhialto at falu.nl>
Cc: freebsd-gnats-submit at FreeBSD.org
Subject: Re: standards/116346: FreeBSD has no conforming C implementation
Date: Fri, 14 Sep 2007 14:44:50 +0200

 On Fri, Sep 14, 2007 at 11:50:12AM +0000, Olaf Seibert wrote:
 > 
 > >Number:         116346
 > >Category:       standards
 > >Synopsis:       FreeBSD has no conforming C implementation
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    freebsd-standards
 > >State:          open
 > >Quarter:        
 > >Keywords:       
 > >Date-Required:
 > >Class:          sw-bug
 > >Submitter-Id:   current-users
 > >Arrival-Date:   Fri Sep 14 12:00:05 GMT 2007
 > >Closed-Date:
 > >Last-Modified:
 > >Originator:     Olaf Seibert
 > >Release:        6.1
 > >Organization:
 > >Environment:
 > FreeBSD twoquid.cs.ru.nl 6.1-RELEASE FreeBSD 6.1-RELEASE #2: Mon Mar 19 15:05:26 CET 2007     root at twoquid.cs.ru.nl:/usr/src/sys/amd64/compile/TWOQUID  amd64
 > >Description:
 > The following strictly conforming little C program fails to compile on
 > FreeBSD 6.1 (and I've had the same report about FreeBSD 7).
 > 
 > int main(int argc, char **argv)
 > {
 >     int unix = 2;
 >     return 0;
 > }
 > 
 > $ uname -a
 > FreeBSD twoquid.cs.ru.nl 6.1-RELEASE FreeBSD 6.1-RELEASE #2: Mon Mar 19 15:05:26 CET 2007     root at twoquid.cs.ru.nl:/usr/src/sys/amd64/compile/TWOQUID  amd64
 > $ gcc c.c
 > c.c: In function `main':
 > c.c:3: error: syntax error before numeric constant
 > 
 > The problem is the pre-definition of the preprocessor symbol "unix". The
 > C standard does not allow that.
 > 
 > Reference: ISO/IEC 9899:TC2 section 7.1.3 "Reserved Identifiers".
 > Para 1 lists the identifiers the compiler may predefine ("reserve").
 > Para 2: "No other identifiers are reserved".
 > http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1124.pdf
 > 
 > Section 4 "Conformance" para 6 says (implies) that a conforming
 > implementation (of C) reserves no identifiers other than those explictly
 > reserved in the C standard.
 > 
 > Therefore, FreeBSD has no conforming C implementation.
 
 
 Yes, it does.  You do however have to invoke the C compiler in
 standard-conforming mode.
 By default gcc (like most C compilers) is not in standards-conforming mode.
 
 Try invoking it as 'gcc -ansi' or 'c89' to get a C compiler conforming to
 the 1989 ANSI C standard.  (Invoking it as 'c99' or as 'gcc -std=c99' should
 get a C99 compiler, although I believe support for the 1999 C standard is
 not quite complete.)
 
 This is all documented quite clearly in the manpages for c89(1), c99(1) and
 gcc(1).
 
 
 
 
 
 
 
 -- 
 <Insert your favourite quote here.>
 Erik Trulsson
 ertr1013 at student.uu.se


More information about the freebsd-standards mailing list