Boost logo

Boost :

From: Daryle Walker (darylew_at_[hidden])
Date: 2001-03-12 16:25:11

on 3/11/01 8:40 PM, David Abrahams at abrahams_at_[hidden] wrote:

> ----- Original Message -----
> From: "Daryle Walker" <darylew_at_[hidden]>
>> The BOOST_STATIC_CONSTANT macro was added to <boost/config.hpp> two days
>> ago. I think it has a slight inefficiency. Here's a copy:

>> My question is: why do we make the user explicitly add the "="? What's
>> wrong with (excuse any line-wrap my e-mail client adds):

> It's a choice between ',' and '='.
> In this case, '=' is more memnonic than ','
> The use of the macro resembles the "ideal" declaration:
> static const bool is_fake = !is_real ;
> BOOST_STATIC_CONSTANT(bool, is_fake = !is_real);

>> Is there some subtle point of macro definitions that keeps this from working,
> No
>> or did we make a silly oversight? If it was an oversight
> Where's the oversight? The silliness? Where's the LOVE?!
> Okay, I'm getting carried away, but seriously: what's wrong with it the way
> it is?

It supports a convention that the user has to remember to use. If the user
forgets the '=', bad stuff may happen. The ',' isn't a convention, it would
be a mandatory separator between macro arguments. If the alternative method
is screwed up, then the preprocessor would complain about a misused macro.
If the current method is screwed up, then the preprocessor will carry it
anyway and the user will get a strange regular-compile-time error.

>> can we change the macro to this form?
> Not without good cause.
>> Yes, I know that I'm asking for an incompatible change, but the macro is only
>> a few days old, so I don't think that there's too much code to change.
>> Within Boost 1.21.0 itself, the macro (name) appears 207 times in 12 files.
>> It could be updated in approximately a day, probably by a team of people with
>> CVS write access. (I'll change them if you guys insist, but I would have to
>> send Beman a ZIP file to merge into CVS.)
> That's a lot of work for a change which buys little or nothing (even less
> than nothing if you consider the memnonic value of '=').

It not too much work; I've already done it so we don't have to worry about
that step (if it's approved). I'm not sure the mnemonic value is worth the
loss of (a little) safety.

Daryle Walker
Mac, Internet, and Video Game Junkie
darylew AT mac DOT com

Boost list run by bdawes at, gregod at, cpdaniel at, john at