Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2005-07-14 20:06:07


"Paul Mensonides" <pmenso57_at_[hidden]> writes:

>> -----Original Message-----
>> From: boost-bounces_at_[hidden]
>> [mailto:boost-bounces_at_[hidden]] On Behalf Of Dave Steffen
>
>> As others have
>> pointed out, it's more convenient in many ways,
>
> It's more convenient in exactly one way only: a particular *editor*
> has trouble properly automatically formatting code.

No, I pointed out several other practical considerations, not least of
which is that if you make a mistake with the other convention, your
compiler is unlikely to tell you about it and your code will be
nonportable.

> The last thing we should be at all concerned about is automatic
> formatting in some editor.

Convenience, usability, and the chance of not making a trivial
unintentional error are important factors in the design of any
component.

>> and IMHO more "natural" to have the semicolon.
>
> You couldn't have said it better. This is *precisely* why there
> shouldn't be a trailing semicolon. This mentality needs to be
> utterly broken--it is the primary reason that macro-related problems
> come up. Macros are not functions. Invocations are are not
> expressions, they are not statements, and they are not declarations.
> They are not part of the syntax model of C++ at all. If you get rid
> the preconception that they are (or should be), it is actually quite
> a bit _less_ natural to have the trailing semicolon. It means that
> the macro only accomplishes *part* of its function--it only
> generates *part* of the code.

Sorry, _what_ means the macro only accomplishes *part* of its
function?

> Sometimes that's necessary; this isn't one of those cases. The
> viewpoint that must prevail is that macros are code writers.

That is my viewpoint, for sure. I'm also in favor of making them as
easy to use and as foolproof as possible.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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