Subject: Re: Compiling NetBSD with another compiler.
To: None <tech-userlevel@netbsd.org>
From: Joerg Sonnenberger <joerg@britannica.bec.de>
List: tech-userlevel
Date: 10/13/2007 16:51:35
On Sat, Oct 13, 2007 at 05:33:02PM +0300, Aleksey Cheusov wrote:
> > Why should I have to go through my perfectly legitimate, legal C
> > program and change all references to the member of my struct that I
> > named "stat" just because the system headers wanted to rename a
> > function?
> Just because you ALREADY do this for many years. Actually EVERY macro
> definition in system headers is a BAD NAME.

The difference is that such MACROS are spelled in upper case.

> Why I (as an application programmer) cannot use name, say, O_CREAT or
> EINTR or _LARGEFILE_SOURCE or something similar as a variable name,
> or function name or structure field etc. We all know - this
> is because they are macro definitions.

Bad examples. EINTR and similiar names are explicitly marked as reserved
for errno.h. Names starting with _ are generally reserved for the system
use.

> So, the system headers ALREADY contain tons of bad names.
> My suggestion ('#define stat stat_new' for "all other" compilers)
> just adds some new "bad names" to the existing big pile,
> NOT CREATE A NEW ONE.

Yes, it certainly creates a huge new pile. Those names are were
explictly reserved for functions. E.g. read SUS and find that you have
to provide a prototype for stat(2) and fgetc(2). Note that the headers
are allowed to define a macro for fgetc, but you can undefine it if you
really want to use it e.g. as member of a struct. The list of allowed
macros with lower case names is quite small.

Joerg