[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GMP C/C++ namespace conflict

From: Hans Aberg
Subject: Re: GMP C/C++ namespace conflict
Date: Tue, 24 Apr 2001 12:39:37 +0200

At 11:59 +0200 2001/04/24, Torbjorn Granlund wrote:
>I don't recognize any of your problems with using a C++ compiler in
>connection with GMP.  What C++ environment are you using?

I use Metrowerks CodeWarrior Pro 5 C/C++ compiler, which is one of the more
compliant (even though it may be old by now, as it is from summer 1999).

The problem is that, by your definition, I got names such as "free" and
"std::free" side-by-side, plus the fact that the confusion happened in the
Flex/Bison output files, meaning that there is no simple way to fix it from
within those (unless one wants to edit the skeleton files). Also, as I
compile these files under C++, the C names "free" etc. end up in the C++
namespace "std".

I think that it is legal, in order to give C++ compiler writers a chance,
to define std:: to be the global namespace ::, in which case you would not
experience any problem on any such compiler. Also, it may be less common to
use "free", "malloc", etc., in C++ code. This happened only because there
is no version for Flex or Bison using operator new() in the output parser

So the safest thing is to change it.

  Hans Aberg

reply via email to

[Prev in Thread] Current Thread [Next in Thread]