Boost logo

Boost :

Subject: Re: [boost] the 'not' keyword
From: Darren Garvey (darren.garvey_at_[hidden])
Date: 2011-10-02 16:33:10


Hi Lorenzo,

On 2 October 2011 21:15, Lorenzo Caminiti <lorcaminiti_at_[hidden]> wrote:

> This might not be a "pure" Boost question but do you know if compilers
> portably support the 'not' keyword?
>
> int main ( ) {
> if(not false) return 0;
> return 1;
> }
>
> This compiles on GCC but not on MSVC... Why? If you look at the C++
> standard, it says that 'not' is part of the language...

I'm not sure why you didn't ask this question on comp.std.c++ instead,
but...

MSVC requires you #include <ciso646> to get the keyword alternatives,
although I've no idea why (since I've recently started to like them).

IIRC, you can also pass /Za to the compiler to disable MS extensions, which
will then re-enable these keywords. Again, don't ask me.

One thing I'm a little curious about is whether the keywords are allowed in
Boost libraries.

Cheers,
Darren


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