Why double not? (!!)
Ryan via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Nov 19 07:40:38 PST 2016
>>>> It's a more concise way of writing:
>>>> GetConsoleCP() != 0
>>>>
>>>> You can do this in C/C++ as well (and presumably some other
>>>> languages).
>>>
>>> Hmmm... thinking about it, it does make perfect sense. The
>>> first ! converts it to bool, the other inverts it back to
>>> it's positive/negative state.
Wouldn't this just be the same as
auto hasConsole = cast(bool) GetConsoleCP(); ?
I think the GetConsoleCP() != 0 code is the clearest about your
intentions.
More information about the Digitalmars-d-learn
mailing list