dual line backtraces for i386.
In-Reply-To: <[email protected]>
Quoted 6 lines · Dave Jones
Quoted 4 lines
Why not:
printk(space == 0 ? " " : "\n"); space = !space;readability ?
Well, if I were going for _un_readability I'd have suggested:
printk(space = !space ? " " : "\n");
:)
Quoted 2 lines
Personally, I despise the ternary operator, because it makes me stop to try to parse it every time I see it.
I think it's a psychological thing because it makes you spend as much time parsing a single line as it would to parse a whole if-then-else and it just feels wrong somehow.
Quoted 2 lines
With the code I wrote
it's blindlingly obvious what is going on.
For simple espressions I think it's about the same, but like you said it's a personal thing. A soon as you start nesting cases the 'if' becomes much clearer. (People who nest ternary expressions should be taken out and shot.)
Signature · 2 lines
Chuck Currently reading: _Thud!_ by Terry Pratchett
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
printk(space == 0 ? " " : "\n"); space = !space;readability ?
Well, if I were going for
_un_readabilityI'd have suggested:printk(space = !space ? " " : "\n");
Anyone voting for "\t" instead of " "?
Jan Engelhardt
Quoted 10 lines · Jan Engelhardt
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
printk(space == 0 ? " " : "\n"); space = !space;readability ?
Well, if I were going for
_un_readabilityI'd have suggested:printk(space = !space ? " " : "\n");Anyone voting for "\t" instead of " "?
Sure: if you use '\t' then you can do:
printk("%c", 9+space++);
space &= 1;
No branches ;)
Quoted 4 lines · Bob Copeland
Sure: if you use '\t' then you can do:
printk("%c", 9+space++);
space &= 1;
Please...
char space = '\t';
[...]
printk("%c", space);
space = ('\t' + '\n') - space;Even fewer instructions and actually somewhat understandable.
-Mitch
Quoted 8 lines
Please...
char space = '\t'; [...] printk("%c", space); space = ('\t' + '\n') - space;Even fewer instructions and actually somewhat understandable.
I see the days of kernelgolf coming...
Jan Engelhardt