I've come across the iso646.h which provides some of the nice logical keyword operators that I'm used to from python. Is one of the following approaches preferred over the other?
if (x>7 && y<-2)
printf("Normal symbols\n");
#include<iso646.h>
if (x > 7 and z < 4)
printf("Iso646 is here\n");
Is there ever a place where one form would be preferred over the other? Or is this like the bool type which is a nice way to replace doing int is_valid=1; ?
<iso646.h>. C++ has the names built-in as keywords. I believe it was added to C for compatibility (or maybe C++ added them for compatibility with C). The!operator may be awkward on some EBCDIC (IBM mainframe) systems. However, there's no major downside to using them other than their unfamiliarity to the average C coder.iso646.horMSE.4to find the information.booltype (from<stdbool.h>, along withtrueandfalse) is more widely used (by far) than the<iso646.h>alternative operator names. Note that the alternative spellings are addressing the same problem that trigraphs and digraphs also address — that C uses a wide vocabulary of punctuation symbols, and some of those symbols are not available in some codesets for non-American languages.booltype is not merely a nice way to replaceint is_valid = 1;- it behaves completely differently from any other integer type w.r.t. value conversion! Thebool is_valid = something;would be more analogous toint is_valid = !!(something);- orint is_valid = not not (something);to keep the theme of the question