News for hackers. Stuff that matters.
Re:1/0 = 0 by user5994461 on Saturday August 11, 2018 @06:09AM (#17739103)
It shouldn't be valid in C++. booleans cannot participate in arithmetic operations. You will get a warning from the compiler if you are lucky.

C doesn't have booleans and treat them as integers 0 or 1, it can do the math and will always return 1.

Re:1/0 = 0 by comex on Saturday August 11, 2018 @06:16AM (#17739117)
That's not true. C++ does define an implicit conversion from bool to int:

https://en.cppreference.com/w/cpp/language/implicit_conversi... (under "Integral promotion")

And C has a boolean type as of C99.