[Dune-devel] [Dune-Commit] [Commit] dune-common - fb7cb2c: [cleanup] Replace or and not by || and !.

Carsten Gräser graeser at mi.fu-berlin.de
Mon Mar 16 10:44:49 CET 2015


Hi Christoph,

Am 15.03.2015 um 23:35 schrieb Christoph GrĂ¼ninger:
> Hi Carsten,
> 
>> could you explain in which sense using ||, &&, and ! instead
>> of 'or', 'and', and 'not' can be considered a 'cleanup'?
> 
> The occurrences of "and", "not", and "or" are very rare. By the
> change of these six lines libdunecommon does not use these C++
> operator synonyms any more.
> Let me quote the lazyweb [1]:
>   "As for their use: because they are rarely used, using
>    them is often more surprising and confusing than it is
>    helpful. I'm sure if it were normal, they would be much
>    easier to read, but people are so used to && and ||
>    anything else just gets distracting."
> 
>> The latter are perfectly valid C++ and supported by any
>> conforming C++ compiler.
> 
> There is not such a thing as a conforming C++ compiler.
> Otherwise we would not constantly work around their bugs ;-)
in my opinion you can't compare a bug in one compiler
that tries hard to follow the standard with the explicit
decision of another compiler to not follow the standard.

I don't understand why we should adapt to this behavior,
especially if the VS docs clearly state that you
can switch it to a more compatible mode using the /Za flag
(or by including iso646.h which is a nop for normal C++ compilers).

Best,
Carsten


PS:
Don't get me wrong, I won't fight for 'and' and friends,
although I personally think using 'and' if you mean 'and'
is much more readable.



> And Visual C++ needs an additional include to support them.
> Maybe this is not a good argument, but my motivation for
> the commit.
> 
> Bye
> Christoph
> 
> [1] http://stackoverflow.com/questions/2376448




More information about the Dune-devel mailing list