Re:Why C++ is vastly superior to C
by mnutt on Saturday May 14, 2011 @11:55AM
(#2547883)
Maybe it's just coming from a dynamic language, but it appears that you've overridden the bool operators to always return true. (except when you pass in 0 and 0.0) If you redefine how two structs of different kinds are compared, who is the compiler to say it's a problem?
[ Parent
| on HN ]
In most dynamic languages 0 is false and anything else is true but it normally wouldn't use that information to coerce two values of different types to booleans before comparing them.
I'm only aware of php and javascript equating 0 to false. But at any rate in this case it's not equating 0 to false, it's comparing non-zero to zero and returning true. (as it should)
Re:Why C++ is vastly superior to C
by burgerbrain on Saturday May 14, 2011 @01:12PM
(#2548065)
In C, 0 evaluates to false.