Ifs and &&s and Plan 9's Source Code
computationallyendowed.com
Ifs and &&s and Plan 9's Source Code
1–10 of 150 posts
Re: Ifs and &&s and Plan 9's Source Code
#2 if(not A and B)
but I'm not sure I've ever seen anyone do it. http://en.cppreference.com/w/cpp/language/operator_alternati...To get them in C, see the note about iso646.h in the link.
Re: Ifs and &&s and Plan 9's Source Code
#3 for (int x = 0; x Re: Ifs and &&s and Plan 9's Source Code
#4Re: Ifs and &&s and Plan 9's Source Code
#5 Dir *b;
, and print the message, this condition would get a lot simpler. I'd find it more readable to write a function bool samefile(Dir *a, Dir *b)
, have it consist of a single-line return statement, and then have the caller just do if (samefile(a, b)) { ... }.Re: Ifs and &&s and Plan 9's Source Code
#6C++ has "and"/"or"/"not" etc., so you can do if(not A and B) but I'm not sure I've ever seen anyone do it. http://en.cppreference.com/w/cpp/language/operator_alternati... To get them in C, see the note about iso646.h in the link.
Also, it's not really that hard to #define it yourself, instead of using includes.
Re: Ifs and &&s and Plan 9's Source Code
#7Re: Ifs and &&s and Plan 9's Source Code
#8C++ has "and"/"or"/"not" etc., so you can do if(not A and B) but I'm not sure I've ever seen anyone do it. http://en.cppreference.com/w/cpp/language/operator_alternati... To get them in C, see the note about iso646.h in the link.
I don't think it really improves readability. All the programmers are familiar with && and ||, and using something else will just confuse people. Also, it's not really that hard to #define it yourself, instead of using includes.
Note that in C++ they are keywords which is superior to macros.
Re: Ifs and &&s and Plan 9's Source Code
#9 if (b != nil)
if (b->bla == a->bla)
is so much clearer (and language agnostic) than if (b != nil && b->bla == a->bla)Re: Ifs and &&s and Plan 9's Source Code
#10As an idiom I quite like this form. I often do similar for double iterations: for (int x = 0; x