Beman Dawes | 1 Jun 1999 03:38

Re: Naming conventions

At 06:18 PM 5/31/99 +0200, Valentin Bonnard wrote:

>I think we should adopt some lexical conventions if we want 
>a consistent naming in Boost.
>
>I suggest to follow Nathan's advice:
>- lower_case variables and functions
>- UpperCase types [actually mixed case, with first letter always
uppercase]

I use that convention myself for applications programs for many
years, and am happy with it.

But most boost submissions so far have been designed to work closely
with the C++ Standard Library, so have followed its naming
conventions.  Some are likely to be proposed for inclusion in the
five year revision to the standard, so the authors of these will be
adamant about following the standard's naming conventions.

So it doesn't look like a good idea to me to flatly say "do it one
way" or "do it the other way".

--Beman

------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/boost
http://www.egroups.com - Simplifying group communications

(Continue reading)

Beman Dawes | 1 Jun 1999 03:49

Re: Header files extention

At 03:55 PM 5/31/99 +0200, Steinar Bang wrote:

>I don't know how relevant this is, but I did a survey some years ago
>about what file name extensions people were using for C++ code, and
>the results are here:
>        http://www.metis.no/private/sb/cppsurvey.html
>(note.  The Deja News article URL no longer works and I was unable
to
>find matches for myself older than 1997 on comp.lang.c++.moderated)
>
>(the result of this survey was that I would have to bite the bullet
>and accept a transition from .cc to the *hated* .cpp extension...:-/
)

Thanks for the data points.

It looks like .cpp and .h are the most common file types.
Like-it-or-not they are the de facto standards.

--Beman Dawes <beman <at> esva.net>

------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/boost
http://www.egroups.com - Simplifying group communications

Nicolai Josuttis | 1 Jun 1999 09:28
Picon
Picon

Re: Header files extention

Beman Dawes wrote:
> It looks like .cpp and .h are the most common file types.
> Like-it-or-not they are the de facto standards.
> 
I hope not!

Using .h as extension really results into a lot of trouble
(as Valentin pointed out when he started this discussion).
It has A LOT of advantages to give C++ files a unique
extension.
I'll definitely stay with .hpp because
 - it is unique
 - it is consistent with .cpp
 - it is intuitive (unlike .hh)
 - it works case insensitive
These are a lot of good reasons!
And (even coming from UNIX) it seems for me that
.hpp is a de-facto standard, too.

Of course, we should not start a style war about this.
However, using .h as extension really does not make any
sense for me (except backward style compatibility perhaps).

--

-- 
Nicolai M. Josuttis
Solutions in Time

http://www.josuttis.de/
mailto:solutions <at> josuttis.de

(Continue reading)

Nathan Myers | 1 Jun 1999 08:01
Picon
Favicon

Re: Naming conventions

Beman wrote: 
> Valentin Bonnard wrote:
> >I think we should adopt some lexical conventions if we want 
> >a consistent naming in Boost.
> >
> >I suggest to follow Nathan's advice:
> >- lower_case variables and functions
> >- UpperCase types [actually mixed case, with first letter always
>    uppercase]

I happen to prefer the form Upper_case over MixedCase.  Besides being 
more compatible with the standard usage, it looks less Java-ish and
Smalltalk-ish, and also more like natural language.

> But most boost submissions so far have been designed to work closely
> with the C++ Standard Library, so have followed its naming
> conventions.  Some are likely to be proposed for inclusion in the
> five year revision to the standard, so the authors of these will be
> adamant about following the standard's naming conventions.

IMHO it would be a mistake for the Boost classes to have identically
the same name as the components proposed for the Standard.  The 
committee will undoubtedly change the interface in subtle or 
not-so-subtle ways.  Then we will have a Boost class with code
that depends on it, and a Standard class with the same name but
with different semantics.

In other words, to me it is a Good Thing if Boost names differ from
proposed Standard names by capitalization.

(Continue reading)

Beman Dawes | 1 Jun 1999 16:34

Re: Header files extention

At 09:28 AM 6/1/99 +0200, Nicolai Josuttis wrote:

>Beman Dawes wrote:
>> It looks like .cpp and .h are the most common file types.
>> Like-it-or-not they are the de facto standards.
>> 
>I hope not!

Well, if Steinar Bang's survey is to be believed (and it certainly
reflects my personal experience) .h at 55% looks a lot more common
than .hpp at 6%.

But until we have more experience with boost, I will accept
submissions with any reasonable file type.

--Beman

------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/boost
http://www.egroups.com - Simplifying group communications

Sean A Corfield | 1 Jun 1999 18:20

Re: Header files extention (overrides previous message)

Valentin Bonnard <Bonnard.V <at> wanadoo.fr> wrote:

[> portable extension > anyway in pratice .hpp seems to be widely used and the 
best.

Fine. So it should be documented in the header policy 
(http://www.boost.org/header.htm).]

I must say I prefer .C/.H but I accept the case sensitivity argument. My 
second preference would be for .cc/.hh but if this is not accepted as default 
for every compiler then I could live with .cpp/.hpp (ISTR AIX's compiler 
required something unusual but you could force it to eat .C/.H - similarly for 
an old Digital compiler).

Whatever we pick, it should be in the header policy. I would also suggest that 
the source & header extensions are 'compatible', i.e., one of the following 
pairs:
	.cc/.hh
	.cpp/.hpp
	.cxx/.hxx

Sean

------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/boost
http://www.egroups.com - Simplifying group communications

Sean A Corfield | 1 Jun 1999 18:20

Re: Naming conventions

Valentin Bonnard <Bonnard.V <at> wanadoo.fr> wrote:

[- rule: macros should be ALL_UPPER_CASE]

I prefer "Macros should not be used" :)

Sean

------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/boost
http://www.egroups.com - Simplifying group communications

Sean A Corfield | 1 Jun 1999 18:20

Re: Naming conventions

Valentin Bonnard <Bonnard.V <at> wanadoo.fr> wrote:

[I suggest to follow Nathan's advice:
- lower_case variables and functions
- UpperCase types]

Much as I prefer that for my own code, it is not the convention the Standard 
Library adopted. Since we are contemplating potential components for a future 
version of the Standard Library, perhaps it might be best to stick to its 
lexical conventions (no matter how much we may dislike them)?

[- the standard name for standard types 
  (that is iterator, not Iterator)]

Absolutely!

[- my personnal convention is UpperCase 
  for namespace names]

Did we determine a namespace hierarchy & policy? (Sorry, I should probably 
check the web site!)

Sean

------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/boost
http://www.egroups.com - Simplifying group communications

(Continue reading)

Sean A Corfield | 1 Jun 1999 18:20

Re: Naming conventions

Nathan Myers <ncm <at> best.com> wrote:

[IMHO it would be a mistake for the Boost classes to have identically the same 
name as the components proposed for the Standard.  The committee will 
undoubtedly change the interface in subtle or not-so-subtle ways.]

That's an interesting point.

[In other words, to me it is a Good Thing if Boost names differ from proposed 
Standard names by capitalization.]

Against, I would say: Boost stuff will be in a different namespace (from std) 
so it won't matter.

However, that's a bit of a thin argument.

OTOH, if our type names differed by case that probably isn't enough: the 
committee are most likely to change signatures so it might help further if we 
used "mixedCase" for variables and functions and "MixedCase" for types. Then 
any multiword variables / functions would be guaranteed different names to 
those in any revision of the Standard...

Just a thought (basically, I don't really care as long as we have a single 
consistent policy for Boost)...

Sean

------------------------------------------------------------------------

eGroups.com home: http://www.egroups.com/group/boost
(Continue reading)

Nicolai Josuttis | 1 Jun 1999 17:55
Picon
Picon

Re: Header files extention

Beman Dawes wrote:
> 
> At 09:28 AM 6/1/99 +0200, Nicolai Josuttis wrote:
> 
> >Beman Dawes wrote:
> >> It looks like .cpp and .h are the most common file types.
> >> Like-it-or-not they are the de facto standards.
> >>
> >I hope not!
> 
> Well, if Steinar Bang's survey is to be believed (and it certainly
> reflects my personal experience) .h at 55% looks a lot more common
> than .hpp at 6%.
> 
> But until we have more experience with boost, I will accept
> submissions with any reasonable file type.
> 
Did you ever try to write a Makefile for both C and C++ headers
using the same extension?
Forget it (at least regarding generic rules).
Excuse me, but having the same extension for C and C++ files is REALLY a bad
idea.
However, I can live with your decision.

--

-- 
Nicolai M. Josuttis
Solutions in Time

http://www.josuttis.de/
mailto:solutions <at> josuttis.de
(Continue reading)


Gmane