3 ms·
In addition to trigraphs, there are apparently a set of C alternative tokens defined as follows: #define and && #define and_eq &= #define bitand & #def
by divbzero 4y ago
In addition to trigraphs, there are apparently a set of C alternative tokens defined as follows:
#define and &&
#define and_eq &=
#define bitand &
#define bitor |
#define compl ~
#define not !
#define not_eq !=
#define or ||
#define or_eq |=
#define xor ^
#define xor_eq ^=
I suppose that allows for code like this:
if (x or not y or not z) {
return 1;
}
https://en.wikipedia.org/wiki/C_alternative_tokens https://en.wikipedia.org/wiki/C_alternative_tokens
- pwdisswordfish9 4y agoMakes for great obfuscated C++. template <typename T> void print(T const bitand foo) { std::cout << foo << std::endl; }
- pjmlp 4y agovoid print(auto const bitand foo) { std::cout << foo << std::endl; } Since C++20.
- pavon 4y agoThe instructor at the branch college where I learned C++ in the late 90's taught us that those were the preferred operators and that the old operators belonged in the wastebasket of history along with printf and str* functions. It made for some amusing group projects when I got to university, when classmates had never seen those operators and were trying to figure out where they were coming from and why I would write such silly things. I trolled them by replacing all my brackets with `begin` and `end` in the next assignment before moving to the standard use of C operators for the rest of the class.