Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
I can buy it though. It will rely on an implicit to make that happen, so using a more strict boolean type probably pays dividends if you have enough int -> bool conversions.
-
@RocketSurgeon
Largely that it's automatically activated with -Wall, despite essential blocking a standard specified feature. -
@metamourge Uh? I'm using -Wall -Wextra and no bool type in C all the time.
My general coding convention is to compare explicitely with NULL, 0 or '\0' depending on which kind of comparison I'm making.
But I compare integers to 0 explicitely only if the 0 is meant as countable quantity, not as logical state like e.g. a flag. -
Hazarth94864yIt's not a big deal, the goal is to minimize implicit conversion. It's not there because It's "bad" but to explicitely warn the user "hey, Im doing some automated work here that you didn't explicitely tell me to do, just so you know"
More options is never a bad thing, I'd be more worried if there was a lack of options in gcc, but there isn't!
I just found out, there is a GCC flag that prevents you from using integers in a bool context in C.
Like wtf?!
Not only is this the original "bool" implementation of C, but it's also a widespread concept for use in NULL checks and the likes.
rant