delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/07/20/07:23:43

Date: Thu, 20 Jul 2000 13:12:53 +0200
Message-Id: <200007201112.NAA14791@loewis.home.cs.tu-berlin.de>
From: "Martin v. Loewis" <martin AT loewis DOT home DOT cs DOT tu-berlin DOT de>
To: eliz AT is DOT elta DOT co DOT il
CC: mrs AT windriver DOT com, djgpp-workers AT delorie DOT com, gcc AT gcc DOT gnu DOT org,
lauras AT softhome DOT net
In-reply-to: <200007200642.CAA09333@indy.delorie.com> (message from Eli
Zaretskii on Thu, 20 Jul 2000 02:42:48 -0400 (EDT))
Subject: Re: GCC headers and DJGPP port
References: <200007192138 DOT OAA01286 AT kankakee DOT wrs DOT com> <200007200642 DOT CAA09333 AT indy DOT delorie DOT com>
User-Agent: SEMI/1.13.3 (Komaiko) FLIM/1.12.5 (Hirahata) Emacs/20.4 (i586-pc-linux-gnu) MULE/4.0 (HANANOEN)
MIME-Version: 1.0 (generated by SEMI 1.13.3 - "Komaiko")
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> I'm not sure what GCC's notion of NULL are you talking about.  We
> cannot use __null in C headers unconditionally, because it will cause
> unresolved externals in C programs, right?

Wrong. As there is no declaration of __null, and as this is not a
function, it will cause a compile error, not an unresolved symbol.

> Use of __null conditioned on __cplusplus is questionable, since
> libc.a is not compiled with that definition of NULL.  Am I missing
> something?

Yes. Please re-read my message elaborating on __null semantics. Usage
of __null does not result in an assembler-level reference to a symbol
named __null; there is no such symbol. As a result, libc.a does not
need to provide anything.

Instead, cc1plus will emit 'zero' immediate values in assembler,
depending on the assembler language (e.g. clearing eax).

> We did use #undef to solve the immediate problem, but it looked like a
> brute-force and potentially dangerous (for C++ programs) solution.  I
> wonder if there's a better one.

Yes. Try to trust the GCC-provided headers more than you currently do.

Regards,
Martin

- Raw text -


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