This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Possible bug in libstdc++ v3


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]