delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/30/01:53:28

Sender: vheyndri AT rug DOT ac DOT be
Message-Id: <351F410D.1574@rug.ac.be>
Date: Mon, 30 Mar 1998 08:51:57 +0200
From: Vik Heyndrickx <Vik DOT Heyndrickx AT rug DOT ac DOT be>
Mime-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: DJ Delorie <dj AT delorie DOT com>, djgpp-workers AT delorie DOT com
Subject: Re: NULL redefined! :(
References: <Pine DOT SUN DOT 3 DOT 91 DOT 980329132539 DOT 14969J-100000 AT is>

Eli Zaretskii wrote:
> 
> IMHO, it is not nice to tell people to put their headers in some
> particular order.  I think we will be flooded by messages which refer
> to this problem if it doesn't get fixed somehow.  If the concensus is
> that we want libstdc++ maintainers to fix their headers, let us
> complain to them, the sooner the better.
>
> However, if nobody else cares, I'm willing to drop the subject, as I
> don't use C++ too much.

I think the issue is more general. But IMO the place of inclusion of the
user's header file is wrong. A quote from the latest ANSI C++ draft (if
somebody can look what's in the actual standard...) which will support
my statement:

17.3.2.1.3
[start quote]
A translation unit shall include a header only outside of any external
declaration or definition,  and  shall  include the header lexically
before the first reference to any of the entities it declares or first
defines in that translation unit.
[end quote]

Since the libstdc++ headers are NOT standard header files (in the sense
of the standard) and since they "refer" to NULL (they test whether it is
defined), they must come after a standard header file that defines NULL.

I can concur with DJ remark that it is a small problem to deal with in
this case, but in less equivalent definitions than NULL, there may be a
problem, i.e. a standard header files defines size_t as "long unsigned
int" and a "user" header file defines it as "short". IMO our headers
need not to be changed, nor does the user's header files, although a
__null definition for c++ may not be a bad idea. The only thing that
NEEDS to be changed is the inclusion order, because it does not comply
to the rule stated above (Eli, a FAQ entry?)

-- 
 \ Vik /-_-_-_-_-_-_/   
  \___/ Heyndrickx /          
   \ /-_-_-_-_-_-_/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019