Re: std::vector crash

From: <WLavrijsen_at_lbl.gov>
Date: Fri, 17 Aug 2007 09:38:14 -0700 (PDT)


Christian,

> Why not?!

it's reserved (from the C standard) for the compiler implementers, including the standard libraries, like here:

> In fact, GCC's libstdc++ uses underscores as the first character of data
> members. See for example "stdexcept":
>
> class logic_error : public exception
> {
> string _M_msg;

As such, any names starting with _ may alias compiler/standard header names.

In practice, starting member variables with an underscore is usually harmless, b/c the class gives a scope. A class/struct name is not protected in the same way, however.

> BTW, using an underscore as the first character of a structure name is a
> _very_ common idiom in C.

Yes, which is why the the C++ standard added that double _ (__) is now also reserved for the compiler writers.

Best regards,

           Wim

--
Wim.Lavrijsen_at_cern.ch   --   WLavrijsen_at_lbl.gov   --   www.lavrijsen.net

"Stop making excuses for your software."    --first step towards quality
   "GIGO is not a valid design pattern."         --corollary
Received on Fri Aug 17 2007 - 18:38:22 CEST

This archive was generated by hypermail 2.2.0 : Fri Aug 17 2007 - 23:50:02 CEST