using std::FILE

Richard B. Kreckel kreckel at ginac.de
Sun Dec 16 23:26:09 CET 2007


Hi Torbjorn!

There's this line in gmp.h.

But std::FILE hasn't been defined and with a conforming C++ compiler it 
won't be unless <cstdio> has been included before <gmp.h>. Note that 
including <stdio.h> is not enough, as it doesn't define namespace std. 
So, defined(__cplusplus) and including <stdio.h> is not enough to 
guarantee that std::FILE is known to the compiler.

Apparently, the intent is to avoid including stdio.h or cstdio. Why? I 
would suggest including it.

Besides, these using declarations are considered bad practice in header 
files. It would be better defining GMP_FILE or similar to either expand 
to FILE or std::FILE and use that instead of FILE.

Cheers
   -richy.
-- 
Richard B. Kreckel
<http://www.ginac.de/~kreckel/>


More information about the gmp-bugs mailing list