Re: std::vector crash

From: cstrato <cstrato_at_aon.at>
Date: Fri, 17 Aug 2007 23:02:19 +0200


Dear Christian

Since it is summer again, and I am on vacation again, see my very old comments:
http://root.cern.ch/root/roottalk/roottalk03/3738.html

So, root does not use some "pretty weird conventions" but did follow Taligent's
Guide, which is still mentioned today:
http://root.cern.ch/twiki/bin/view/ROOT/CodingConventions

P.S.: Do not take my comments too seriously. As you said, all sorts of naming
conventions are allowed.

Best regards
Christian

_._._._._._._._._._._._._._._._
C.h.i.s.t.i.a.n S.t.r.a.t.o.w.a
V.i.e.n.n.a       A.u.s.t.r.i.a
_._._._._._._._._._._._._._._._

Christian Holm Christensen wrote:
> Hi Axel,
>
> On Fri, 2007-08-17 at 12:43 +0200, Axel Naumann wrote:
>
>> Hi Ilya,
>>
>
> ...
>
>
>> Totally independent remark:
>> type names should not start with an underscore in C(++).
>>
>
> Why not?! A valid identifier in C/C++ has the following form
>
> [_a-zA-Z][_a-zA-Z0-9]*
>
> That is, a letter or an underscore, follow by zero or more letters,
> numbers, or underscores. You can even use UTF encoded identifiers if
> you like - the standard, I believe, is quite explicit about that.
>
> 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;
>
> There's absolutely _nothing_ wrong with using underscores as the first
> character of an identifier in C++. Personally, I prefer an underscore
> over ROOT's "f", but that's my preference, and I have the freedom to
> choose that convention.
>
> ROOT has, in my mind, some pretty weird conventions on this: For
> example, all classes (more or less) start with a `T' rather than live
> inside a `ROOT' name space, some class names are abbreviated beyond all
> recognition (TH1), and `modules' are differentiated by name rather than
> by structure (TGeo<XXX> should really be ROOT::Geometry::<XXX>, TG<YYY>
> should be ROOT::Gui::<YYY>).
>
> The point is, that there's all sorts of coding and naming conventions
> out there, and you are free to choose what ever you like, for better or
> for worse.
>
> BTW, using an underscore as the first character of a structure name is a
> _very_ common idiom in C. One then often finds a typedef from the
> structure name to the same name, but without the leading underscore:
>
> typedet struct _foo {
> ...
> } foo;
>
> That means you can write some stuff shorter, like
>
> void bar(foo* f);
>
> rather than
>
> void bar(struct _foo* f);
>
> However, as structures are just like classes (except members are public
> by default) in C++, and the `class' or `struct' prefix is not needed, it
> does not make much sense to use this idiom in C++. Doing
>
> struct foo { ... };
> void bar(foo* f);
>
> is perfectly legal C++ (but not legal C).
>
> Yours,
>
>
Received on Fri Aug 17 2007 - 23:02:26 CEST

This archive was generated by hypermail 2.2.0 : Mon Aug 20 2007 - 17:50:02 CEST