This is the mail archive of the libstdc++@sourceware.cygnus.com 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: C++STYLE


On Wed, 17 May 2000, Phil Edwards wrote:

> "The Standard," more formally known as *deep breath* International
> Standard 14882:1998, "Programming Lanaguages -- C++," from our friends at
> the International Standards Organization / Internation Electrotechnical
> Commission.

   Oh, that 14882.  Doh.  Somehow I never quite connect the number with the
publication even tho I have it more or less as a permenant part of my desktop...

>
> Disclaimer:  I haven't used Insight.  What about the current format doesn't
> "work well" with gdb?  I can debug the library inside dd pretty well.

   More newlines would help.  Primarily, putting braces and each statement on
separate lines so that one can set breakpoints, inspect data and single step
more or less in correspondence with sequence points in the execution.  ie
 
void
foobar (sometype const &c)
{
   do_something_to (c);
}

is preferrable to 

void
foobar (sometype const &c)
{ do_something_to (c); }

since if you want to inspect the contents of c,  the actual passed value isnt
visable until the execution has passed the opening brace and the stack frame
has been set up.

foobar () :
   some_init (),
   some_init2 (),
   some_init3 ()
{
}

is preferable to

foobar () : some_init (), some_init2 (), some_init3 () {}

since one might want to step over some_init and step into some_init2.

-- 
Steven King
sxking@uswest.net

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