stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: Another style question
Date Wed, 16 Apr 2008 19:36:40 GMT
Eric Lemings wrote:
>  
[...]
>> Btw., a more flexible way to code these workarounds would have been
>> to code it like so:
>>
>>    #if !_RWSTD_NO_MEMBER_TEMPLATES
>>        // correct code
>>    #else
>>        // workaround
>>    #endif
>>
>> This way, each config macro could be #defined on the command line
>> to 0 or 1 to toggle either branch (e.g., for testing and debugging).
>> That's not possible with the #ifndef approach.
> 
> From a natural language perspective, I've always found the double
> negatives (e.g. `#ifndef _RWSTD_NO_FOO) a bit irritating but that's
> just me.

I don't like it either but I think it has two important advantages
over the alternative (e.g., the GNU HAVE_FOO style). First, in a 100%
conforming environment our convention makes it, at least in theory,
possible to compile the library without having to configure it,
while the other always requires the config tests, or will produce
a badly crippled library when none of the config macros is defined.
Second, our approach will end up with fewer #defined macros than
the other strategy.

Martin

Mime
View raw message