standards/116346: FreeBSD has no conforming C implementation
Rhialto
rhialto at falu.nl
Fri Sep 14 06:40:06 PDT 2007
The following reply was made to PR standards/116346; it has been noted by GNATS.
From: Rhialto <rhialto at falu.nl>
To: Erik Trulsson <ertr1013 at student.uu.se>
Cc: freebsd-gnats-submit at FreeBSD.org
Subject: Re: standards/116346: FreeBSD has no conforming C implementation
Date: Fri, 14 Sep 2007 15:35:06 +0200
On Fri 14 Sep 2007 at 14:44:50 +0200, Erik Trulsson wrote:
> 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.)
Of course no makefile project ever does that at all, in practice, yet
they still expect to have the promised namespace available for their own
identifiers.
I was made aware of this problem when some project was using the "unix"
preprocessor definition as a feature test, and it failed to build on a
different BSD system, which IMHO is more correct in this regard.
I don't know where to look this up in POSIX and related standards, but I
don't expect that any of them actually *requires* a pre-#defined unix,
since they most likely don't want to contradict the C standard. If they
would mention any such feature test at all, they would require
#inclusion of some specific header first, or use a name which is
reserved to the implementation, such as __unix__.
Otherwise, by your reasoning, the default-invoked compiler could do
anything, and you would not need to bother having all those __-prefixed
names in /usr/include/sys/*.
Therefore, there is no standards-related reason for having "unix" and I
still argue for removing it.
-Olaf.
--
___ Olaf 'Rhialto' Seibert -- You author it, and I'll reader it.
\X/ rhialto/at/xs4all.nl -- Cetero censeo "authored" delendum esse.
More information about the freebsd-standards
mailing list