Date: Sat, 22 Apr 1995 13:27:45 +1000 From: Bruce Evans <bde@zeta.org.au> To: hackers@FreeBSD.org, rpt@miles.sso.loral.com Subject: Re: _ANSI_SOURCE... who defines this puppy Message-ID: <199504220327.NAA06522@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
>I am trying to get pthreads to build on 2.0R. I have had a number of >problems, but this last one led me down a rat hole that seems to go >beyond pthreads. In one source file was : > #if !defined(_ANSI_SOURCE) > #define CLK_TCK 100 > #endif /* not ANSI */ This is bogus. CLK_TCK is an (obsolescent) POSIX feature. It has nothing to do with ANSI C, and of course applications and libraries shouldn't declare it directly, because it may be (and is in FreeBSD) different from what the application might expect. >This resulted in redefinition of the value in <machine/limits.h>. >So I started to try to hunt down who defines _ANSI_SOURCE. I found it >referenced numerous times in places in the standard includes. But I >can't find anywhere that it is defined. The best gcc does is: ><~/code>> cc -E -dM -ansi foo.c >#define __STRICT_ANSI__ 1 >... >So is this the programmers responsibility to define? Yes. You normally wouldn't want to define it. In FreeBSD, it is supposed to restrict what the ANSI headers declare to only those things that are specified in the standard. Very few things can be compiled using only features that are specified in the standard! __STRICT_ANSI__ is what gcc declares to indicate that the compiler is enforcing strict ANSI C syntax. It is not related to restricting or extending the declarations in the headers. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504220327.NAA06522>