Detection of stdio.h in gmp.h

Vincent Lefevre vincent+gmp at vinc17.org
Sat Oct 18 01:38:04 CEST 2003


On 2003-10-17 15:13:50 -0400, James Antill wrote:
>  Well I guess it's not unknown for people to define EOF themselves
> (at least historically).

When they define EOF themselves (which is a bad idea), do they do
that before or after including the headers? If after, there would
be no problems. Otherwise, they could fix their programs anyway. :)

However, they could do something like the following:

#include <non_standard_header.h>
#include <gmp.h>

and <non_standard_header.h> could define EOF. Using SEEK_SET would
probably be a better idea, as it should be less often defined outside
<stdio.h>.

>  Looking at ISO 9899:1999 7.19.1.3 stdio.h has to (to be conforming)
> define the following macros...
> 
> NULL
> _IOFBF
> _IOLBF
> _IONBF
> BUFSIZ
> EOF
> FOPEN_MAX
> FILENAME_MAX
> L_tmpnam
> SEEK_CUR
> SEEK_END
> SEEK_SET
> TMP_MAX
> stderr
> stdin
> stdout

NULL is defined in other headers and most macros are new; stderr,
stdin and stdout are not necessarily macros.

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/> - 100%
validated (X)HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, etc.
Work: CR INRIA - computer arithmetic / SPACES project at LORIA


More information about the gmp-devel mailing list