Subject: Re: [boost] [new Warnings policy] MS C4180 on the MaintenanceGuidelines
From: John Maddock (john_at_[hidden])
Date: 2009-11-17 11:41:00
>> Looks OK to me but anyone 'deprecating' this before I add it to the
>> Are we sure that all compilers can evaluate this as compile time -
>> while debugging users might find it a pest?
> While this is a a workaround that disables the warning, I personally find
> it almost unreadable, and wouldn't want to encourage it's usage. In my
> mind when I see a ! I think "not", and have to always apply extra brain
> power to realise there are 2, and what it means.
I accept that this idiom has it's uses though - for example where the type
being tested has an operator !() but no direct conversion to bool - although
the "safe bool conversion idiom" used in Boost and elsewhere is IMO superior
What's wrong with using either x != 0, or x == 0, depending on which result
you want? It's pretty explicit , and exactly mirrors what the compiler has
to do internally to convert x to a bool in the first place?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk