DEV Community

Discussion on: Modern C++ : `and`, `or` and `not` as Boolean Operators

Collapse
 
idanarye profile image
Idan Arye

Why would they even do that? Even if you are not a pedantic preacher of the only-one-way-to-do-it philosophy, there should at least be a reason for having multiple ways to do it...

Collapse
 
larzhino profile image
Larz

It's really disingenuous to label this "Modern" C++. It's a legacy C feature to support keyboards that didn't have all the previously accepted symbols (en.wikipedia.org/wiki/Digraphs_and...) or to make it more accessible for people with trouble inputting all the symbols.

Collapse
 
darthwalsh profile image
Carl Walsh

Interesting, I knew about trigraphs but apparently they went away in C++17. and isn't strictly a C language feature: it's a language keyword in C++ but is a macro in C.

Here's more docs on the and/or/not alternative operators: en.cppreference.com/w/cpp/language...

Collapse
 
safijari profile image
Jariullah Safi

Heh, that's funny. One of my colleagues once went on an angry tirade about how "modern" C++ was ruining programming by allowing you to have a one statement if block without any surrounding curly braces...

I didn't have the heart to tell him...