Russ Allbery <r...@stanford.edu> writes: > Yeah. But I suspect it was a mistaken statement. The subject line from > the referenced comp.lang.c thread was:
> c99 and the lack of warnings when int operations are applied to a bool > which I think is best caught by the conversion *to* bool when the result > is stored, rather than the conversion *from* bool to perform the > operation. I've just briefly reviewed the thread, and it was about both, including some discussion of warning about any operation that promotes a bool to some other integer type, on the grounds that a bool would ideally be treated as a special enumeration that didn't behave like an integer. (With others pointing out that that isn't the programming language that we have, as appealing as it might have been if designing C from scratch.) But I think most of the *practical* problems would be caught by warning about the implicit integer conversion to bool, if there's a way to wedge that warning into the language. (I suspect it might be hard because the integer conversion may happen under the hood in lots of places that people don't expect, but I don't know much about the internals.) -- Russ Allbery (r...@stanford.edu) <http://www.eyrie.org/~eagle/>