Possible bug in libstdc++ v3

Stephen M.Webb stephenw@cryptocard.com
Wed Aug 1 13:20:00 GMT 2001


On Wed, 01 Aug 2001, Vitaly A. Repin wrote:

> #include <string>
> #include <stdexcept>
> 
> using std::string;
> 
> class bad_cfg : public std::runtime_error {
> public:
>         bad_cfg(const string& reason, const int err_num=0) throw();
> private:
>         const int errno;
> };

The name 'errno' is required to be a preprocessor macro by the C++ standard, and
it looks like one of the headers you are including defines that macro.

Other implementations may accept your code because the standard does not define
which standard header files may include other standard header files.  Both
implementations may be standard-conforming.

You're better off treating any of the standard-mandated preprocessor symbols as
reserved words, but if you're in a bind you can always #undef the name after all
your #includes.

Stephen M. Webb



More information about the Libstdc++ mailing list