[Top][All Lists]

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

Does cstdlib pollute the global namespace?

From: Jeff Schwab
Subject: Does cstdlib pollute the global namespace?
Date: Thu, 18 Oct 2007 09:58:04 -0700
User-agent: G2/1.0

Is the following error message correct?  It seems like system() ought
to be in the ::std namespace.  What am I missing?

    #include <cstdlib>
    namespace system { }

    $ g++ -ansi -pedantic -Wall -c error: 'namespace system { }' redeclared as different
kind of symbol
    /usr/include/stdlib.h:738: error: previous declaration of 'int
system(const char*)'
    make: *** [main.o] Error 1

My current work-around is an unnamed "wrapper" namespace:

    namespace { namespace system { } }

reply via email to

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