[aspectc-user] Another std:: Issue

Gary Duzan gduzan at bbn.com
Fri Aug 8 14:50:41 CEST 2003

In Message <3F33655D.7040505 at pure-systems.com> ,
   Matthias Urban <matthias.urban at pure-systems.com> wrote:

=>Gary Duzan wrote:
=>>    I know the std namespace problems are being addressed in general,
=>> but I wanted to toss out one more that I encountered.  It seems that
=>> G++ will accept "bad_alloc" even though the "new" header defines it in
=>> namespace std, but ac++ produces an "invalid statement" statement error
=>> when "bad_alloc" appears in a catch(). I'm trying to get the ACE folks
=>> to use "std::bad_alloc", which would fix the problem from the other end,
=>> but I expect this is the sort of thing you'd want ac++ to handle.
=>I suppose you're using gcc 3.x, right? Before version 3.x the g++ 
=>headers contained a "using namespace std;" handling the unqualified use 
=>of C++ library stuff. This was definitely removed since 3.x. Using the 
=>3.x <new> does not allow to use bad_alloc without qualifying (I'm using 
=>3.2), but there is a <new.h> for backward compatibility defining "using 
=>std::bad_alloc" and so on. Either you use <new.h> or you may place a 
=>"using namespace std;" (or similar) everywhere you need it by yourself 
=>because ac++ *can not* do it for you. Though std is always known (must 
=>be predefined acc. to ISO C++) ac++ can't introduce its members in 
=>global scope per default -- this lies in the hand of the programmer.

   No, actually I'm not:

Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.2 2.96-112.7.1)

ACE is including <new>, and while <new.h> has some "using" statements,
"std::bad_alloc" isn't one of them. I'll have to dig into this a bit more
to see what's going on. However, I'm pretty sure G++ is adding this name
in by magic, similar to what it does with UINT_MAX and such.

					Gary Duzan
					BBN Technologies
					A Verizon Company

More information about the aspectc-user mailing list