3 ms·
Digraphs were supposed to be a easier-to-read alternative to trigraphs. Unfortunately, the extended list of digraphs with many additional logic operators by C++
by segfaultbuserr 7y ago
Digraphs were supposed to be a easier-to-read alternative to trigraphs. Unfortunately, the extended list of digraphs with many additional logic operators by C++ never entered C, i.e.
%:%: ##
compl ~
not !
bitand &
bitor |
and &&
or ||
xor ^
and_eq &=
or_eq |=
xor_eq ^=
not_eq !=
C only has basic ones (still more intuitive than trigraphs).
<: [
:> ]
<% {
%> }
%: #
Last time, I had to type a C program on a touchscreen, and those symbols were extremely difficult to enter. I knew digraphs can help, but then realized that I couldn't use the digraphs for logic operators without programming C under C++.
- hvdijk 7y agoC has the named operators as macros in <iso646.h>.
- segfaultbuserr 7y agoGreat tip, thanks. Have to remember this magic ISO standard number.
- ncmncm 7y agoAlso, have to remember to #undef them in any file that includes something that includes iso646.h.
- himinlomax 7y agoShould've been `bitxor`