2 ms·
We're talking about C here, not C++. The keywords don't exist in C unless you #include "iso646.h"
by eqvinox 7y ago
We're talking about C here, not C++. The keywords don't exist in C unless you #include "iso646.h"
- jcelerier 7y agolet me quote you the comment I was replying to : > I have seen people coming to C++ from Python use "and", "or", and "not" in their if-statements :)
- eqvinox 7y agoYet curiously absent from that quoted comment is anything about it being a problem, which you nonetheless ask about. I wonder if more context or a more well-intentioned reading is the solution? ;)
- jcelerier 7y agoI read and reread it and I honestly don't understand how it is possible to come up with an interpretation where that is not seen as an issue by the author
- pjmlp 7y agoSo what? Unless you include std...h you also need to use _Bool, _Complex and so forth, hardly much different.
- int_19h 7y agoBut the repo doesn't include them - it defines them itself. Technically, I believe this is actually UB, just like any other #define for a keyword or an identifier from the standard library.
- pjmlp 7y agoI don't follow. When I do #include <stdbool.h> it also brings the #define bool _Bool, a keyword from the standard library. How is it UB?
- int_19h 7y agoIt's not UB to #include standard headers that do such things. It is UB to #undef or redefine them yourself, though. And it looks like <stdbool.h> gets an explicit exemption, at least in C11: "Notwithstanding the provisions of 7.1.3, a program may undefine and perhaps then redefine the macros bool, true, and false" I guess it's because defining these was so common even before C99. But there's no similar verbiage for <iso646.h>, so...