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: auto_ptr in locale


Benjamin wrote:
> Nathan wrote:
> > I agree that the code Kevin is replacing is badly wrong, and that his 
> > code seems to fix the parts visible in the patch.  However, I don't
> > like his choice of names (pvf and pcn) -- they look like Hungarian
> > notation to me, and are singularly uninformative.  Furthermore, since
> > this code is in a ".cc" file, they don't need to be uglified.  
> > Furtherfurthermore, the typedefs __vec_facet and __vec_string disobey
> > the library naming convention that non-standard type names are 
> > capitalized.
> 
> I believe this code should be uglified, and for the following reason:
> what if this this code is later changed, and inlined? Furthermore, why
> add yet more complexity with respect to when things are uglified and not
> uglified?

Code moves from .cc files to .h files only once in a blue moon.
Uglification is used for a reason.  Why make things ugly when the 
reason doesn't apply?  People might think we just like our code ugly.
 
> The typedefs are my fault. I thought just template params started with the
> _[A-Z]* stuff. A quick look at C+++STYLE
> 
> http://sourceware.cygnus.com/libstdc++/17_intro/C++STYLE
> 
> proves me wrong.
> 
> I don't especially like this style. (for type names, not template
> parameters). Type names in the standard are lowercase,
> underscore-deliniated names. (I'm thinking of containers and 
> iostream, stuff like int_type and char_type.) It seems a better fit to
> me to prepend two underscores for non-standard types. (In terms of
> matching the typographic conventions in the standard.) 

We don't _want_ to match the typographic conventions in the standard.
Those conventions were arrived at by a tortuous political process
which guaranteed that none of the participants would like the result.
(That was achieved.)  Nobody wanted to risk re-opening that issue,
however much they disliked the status quo, because we had too much
work to do already.

Anyway, the standard-specified parts of the library _should_ look 
different from the rest.  That helps you to distinguish what is 
specified from what may be changed.

> Looking at the
> sources in /bits, most everything uses this style except for the valarray
> bits, which are in strict conformance to C++STYLE. 

That seems an exaggeration.  Iostreams, of course, came to us before
we had a codified style.  The rest of the code that I have in bits/
conforms.  (I haven't checked what has been done to it since.)

> The stil/bits directory is similarly confused.  Perhaps you can clue 
> me in--what went into picking the current C++STYLE convention?

It is important in C++ code that type names be visually distinguishable 
from the non-type names.  Capitalizing type names is the minimal 
visually-distinguishable difference, and is appropriate because 
type names have a role similar to proper names in English.

It is at best unfortunate that the standard's naming convention 
did not observe this distinction.  Stroustrup and most of us on
the library WG regret it.

Nathan Myers
ncm@nospam.cantrip.org

p.s.  If you reply to this, please reply to the list, and not to me.


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