delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/10/01:38:55

Date: Mon, 10 Mar 1997 08:25:52 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Jerzy Witkowski <Jerzy DOT Witkowski AT ii DOT uni DOT wroc DOT pl>
cc: djgpp AT delorie DOT com
Subject: Re: libgmp
In-Reply-To: <x6209pq7o0.fsf@swiatowit.ii.uni.wroc.pl>
Message-ID: <Pine.SUN.3.91.970310081804.28031C-100000@is>
MIME-Version: 1.0

On 9 Mar 1997, Jerzy Witkowski wrote:

> Here is the mentioned clause from file `gmp.h': 
> 
> #if defined (FILE) || defined (H_STDIO) || defined (_H_STDIO) \
>  || defined (_STDIO_H) || defined (_STDIO_H_) || defined (__STDIO_H__) \
>  || defined (_STDIO_INCLUDED) || defined (__dj_include_stdio_h_)
> #define _GMP_H_HAVE_FILE 1
> #endif
> 
> I just continued the author's idea.  :-)

And one bad idea it is, indeed.

If a program needs to know whether FILE datatype is defined, it should use
other methods than relying on symbols defined by headers (to protect
themselves from multiple inclusion).  I suspect that what the program
really wants is to see whether <stdio.h> has already been included (by
some other header) to avoid including it for the second time.  But since
any decent compiler/library should protect itself, this is unnecessary and
harmful.  It is harmful because no standard document defines what that
symbol should be, and a new release of a library can definitely change
that symbol, thereby breaking the program. 

- Raw text -


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