0

'Cause whenever I try one of these lines:

#define and &&
#define or ||
#define not !

I get the error:

1:9: error: "not"/"and"/"or" cannot be used as a macro name as it is an operator in C++
user6245072
  • 2,051
  • 21
  • 34
  • 1
    http://stackoverflow.com/questions/2419805/when-did-and-become-an-operator-in-c – FCo Apr 26 '16 at 13:41
  • Why... would you ever want to define those? Why make your code unreadable? – Matti Virkkunen Apr 26 '16 at 13:47
  • 1
    Unreadable? Come on. – user6245072 Apr 26 '16 at 13:52
  • Unexpected is unreadable. I bet next you'll be doing `#define loop for` – Matti Virkkunen Apr 26 '16 at 13:55
  • Nah. `#define for for(` is enough for me – user6245072 Apr 26 '16 at 13:57
  • @MattiVirkkunen: Apparently you're missing the point here: `and` **already** means `&&`. – MSalters Apr 26 '16 at 14:36
  • @MSalters: They do but that's no reason to use them. Alternate operators for the same thing AFAIK is a hack to account for obsolete character encodings. Trigraphs are already slated for removal in C++17 and I wouldn't be surprised if the rest of the silly alternate representations will follow shortly after. – Matti Virkkunen Apr 26 '16 at 14:39
  • I guess starting coding with strange, non-natural symbols makes you less flexible in reading code, as I can read C/C++ syntax without problems even if I started with and, or, not, end, then, where you seem to have problems when encountering non-symbolic keywords. – user6245072 Apr 26 '16 at 15:01

1 Answers1

1

These keywords are already defined. Please have a look http://en.cppreference.com/w/cpp/language/operator_alternative

paceholder
  • 1,064
  • 1
  • 10
  • 21