4 ms·
I dont think it would look that out of place if he was using the ternary operator which is the same thing after all. E.g.: if (peekc) { c = peekc; p
by bawolff 6y ago
I dont think it would look that out of place if he was using the ternary operator which is the same thing after all.
E.g.:
if (peekc) {
c = peekc;
peekc = 0;
} else
eof ?
return(0) :
c = getchar();
The first else clause sill looks weird, but the final part isn't nearly as out of place (well i guess assigning in a ternary would be weird, but in terms of indentation) and its not like we actually changed anything.
- andreareina 6y agoCan't return in a ternary.
- amelius 6y agoCorrect, return is not an expression. But then again, he could if he wanted to, as the language designer ;)
- Maken 6y agoMaybe it was not worth the extra work.
- Koshkin 6y agoWouldn't it be wonderful if we could write a = return b;
- colejohnson66 6y agoWhat would that even do? Return b, but then set b to a right before “deleting” a? That would serve no purpose.