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

Torbjorn Granlund tg at swox.com
Fri Jul 25 17:15:14 CEST 2008


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

  > 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?
  
  I know libstdc++ uglifies all variable names, but only compiler 
  implementors have this luxury (using __gmp* in gmp is already forbidden 
  and generates warnings with some compilers).
  
In C, underscore-prefixed identifiera are "reserved for the
implementation", and since GMP implements something, I have decided
that __GMP and __gmp are OK to use.  :-)

  I think mostly in C++ you can consider it the user's fault if they #define 
  short variables, although we recently had problems with solaris defining 
  plenty of macros with just two capital letters.
  
  If noone complains, I wouldn't worry about this.
  
OK.
  
  The whole point of using a typedef is so we can have the extern "C"...
  
  modifying it to:
  extern "C" {
     typedef ...;
  }

  seems to help at compile time, but then the linker gives funny messages.

Thanks, I'll try this for the next night's tests.

-- 
Torbjörn


More information about the gmp-bugs mailing list