6 ms·
I read the article and in fact the versions of stdbool look pretty close to what he said. Maybe there is some subtly there I am missing but I do not see it.
by tonetheman 13y ago
I read the article and in fact the versions of stdbool look pretty close to what he said.
Maybe there is some subtly there I am missing but I do not see it.
- induscreep 13y agoThe subtlety is that bool expands to _Bool, not int. So bool is actually a macro, not "typedef int bool" as in Linus' example code snippet.
- yuubi 13y agoThe important bit seems to be the behavior of the _Bool type, not the macroness (also, the [Future Directions section of the Open Group spec](http://pubs.opengroup.org/onlinepubs/007904875/basedefs/stdbool.h.html#tag_13_46_06 http://pubs.opengroup.org/onlinepubs/007904875/basedefs/stdb...) says #undefing and redefining the macros is obsolescent, leaving open the possibility of changing the implementation from a macro to something else entirely).
- gnud 13y agoLinus' example code was showing a typical compatability hack, that can easily cause unintended consequenses and hard-to-debug problems.