Boost logo

Boost :

From: Darin Adler (darin_at_[hidden])
Date: 2001-12-29 16:00:36


You should look at the Boost coding guidelines draft at
<http://groups.yahoo.com/group/boost/files/coding_guidelines.html>. In
general, the style guidelines we care about the most are the ones that
affect the public interfaces for Boost libraries.

On 12/28/01 2:28 PM, Thomas Lien <tgunlien_at_[hidden]> wrote:

> 1) I've noticed many member variables for boost
> libraries end with an underscore. Is this a
> defacto-standard? Should a standard care about such
> things?

Many C++ programmers like a terse way of distinguishing data members from
other variables. Since they are private, these names don't affect the
interfaces of the classes they are in. The trailing underscore is popular
because it's about as terse as you can get, and unlike the leading
underscore it doesn't take you into the vicinity of dangerous standard
non-compliance territory.

Although some would say that this is not something we'd want to standardize,
the Boost coding guidelines draft does suggest an "m_" prefix rather than an
"_" suffix.

> 2)
> while(true) {
> // ...
> }
>
> OR
>
> while(true)
> {
> // ...
> }

Although some would say that this is not something we'd want to standardize,
the Boost coding guidelines draft suggests the latter rather than the
former.

> 3) Why do concepts have all the capitalization style
> instead of underscore separated style
> (DefaultComparable instead of default_comparable)?

It's essentially arbitrary and traditional, but template formal type
parameters use mixed case, in part to minimize the chances of conflict with
the actual types.

This is covered in the coding guidelines draft too.

    -- Darin


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk