5 ms·
Not entirely related to the post, but what's the sane use case for doing: return (expr, expr) like in the first example? I cannot think of a good reason to
by iano 12y ago
Not entirely related to the post, but what's the sane use case for doing:
return (expr, expr)
like in the first example? I cannot think of a good reason to do this.
- octo_t 12y agoIt simplifies the grammar, immensely.
- deleted 12y ago[deleted]
- kzrdude 12y agoI know this mainly as a useful macro implementation trick if where you want to be able to use it in an expression.
- eatnumber1 12y agoIf the min macro would have worked, it would have allowed the two lines min(1, 2, out); return out; to be condensed into one line.
- tkmcc 12y agoIt may not be a good reason to do this, but you can condense if (failure) { errno = EINVAL; return -1; } into if (failure) return (errno = EINVAL, -1);
- jabagawee 12y agoIn any sane code, you'd have the open and close brackets anyways, so all this code does is trade a few '\n' characters for a few parentheses characters. I'd opt for the former still.