Compiling a C program with g++ 4.3.1 yields an error about std::FILE

Torbjorn Granlund tg at swox.com
Thu Jul 24 17:15:34 CEST 2008


Marc Glisse <marc.glisse at normalesup.org> writes:

  "safe": I am quite sure it is correct (whereas the current code isn't), it 
  helps with sunpro, and it does not break g++-4.3. I don't have much else 
  available here to test on...
  
Thanks!  I put it in and wait for the next automated build.

  The name freefunc_t is just an exemple, it would probably be better if it 
  was prefixed by gmp_ or something like that. The typedef could also be 
  moved to gmp.h as it seems like a useful addition to anyone who wants to 
  use mp_get_memory_functions, whether in C or C++, and in there it would 
  naturally fall inside a extern "C" when compiled in C++.
  
I'll leave it in gmpxx.h for this dot-release.

Why have the freefunc_t globally in gmpxx.h, why not put it into the
function, to avoid namespace pollution?

A related isue with gmpxx.h: We use many short, non-prefixed variable names like
"s", and "f" and "z" in gmpxx.h.  If a user decides to say

   #define s )

before includng gmpxx.h, I think gmpxx.h will not work too well.  In
C, one typically uses prefixes to avoid this.  Shouldn't this be done
for gmpxx.h also?

-- 
Torbjörn


More information about the gmp-bugs mailing list