Post #4370149
2026-08-04 07:51 UTC
C and C++ developers often use !, && and ||.
Many don't know that not, and and or (among others) have been part of C and C++ for 3 decades.
They were introduced to C in 1995, and to C++ in 1998.
if (!ok)
if (not ok)
if (var_a && var_b)
if (var_a and var_b)
if (var_c || var_d)
if (var_c or var_d)
Personally, I much prefer using the keywords not, and, and or. I find it makes the code much easier to read naturally. #C #Cpp
Replies (2)
-
@DanielaKEngert@hachyderm.io 2026-08-04 08:20
@charette@mstdn.ca Absolutely! I have switched over to named boolean operators about 5 years ago for improved clarity and readability. On top of that, a single '!' or a missing '!' is easily overlooked.
-
@sirwumpus@tilde.zone 2026-08-04 08:55
@charette@mstdn.ca Only if you #include , see C17 section 7.9 Alternative spellings . Section A.1.2 Keywords does not list them.