Why double not? (!!)

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 19 07:50:26 PST 2016


On Saturday, 19 November 2016 at 15:40:38 UTC, Ryan wrote:
> Wouldn't this just be the same as
> auto hasConsole = cast(bool) GetConsoleCP(); ?

Yes, it is in D, though the habit often comes from C where things 
are different. But people also may prefer !! for just being 
shorter and once you know the pattern, you'll see them as meaning 
the same thing.

> I think the GetConsoleCP() != 0 code is the clearest about your 
> intentions.

yeah that's my preference too. But they still mean the same thing 
so you get used to all the forms.


More information about the Digitalmars-d-learn mailing list