[aspectc-user] Another std:: Issue

Matthias Urban matthias.urban at pure-systems.com
Fri Aug 8 10:54:53 CEST 2003


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.


Matthias Urban                          Phone: (+49) 0391 544569-32
pure-systems GmbH                       Fax:   (+49) 0391 544569-90

More information about the aspectc-user mailing list