Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22133

What is it called when a block returns a value?

$
0
0

I came across this code recently, which doesn't look legal to me (but gcc compiles it). I don't so much mind the construction as want a name for it:

#define MAX(a,b) \
({ \
    typeof(a) _a = (a); \
    typeof(b) _b = (b); \
    (_a > _b) ? (_a) : (_b); \
})

Apparently, the last statement's value is being returned as the "value" of the expression bounded by the namespace.

Edit: Thanks for the answers guys. Turns out this is an extension to plain C called Statement Expressions.


Viewing all articles
Browse latest Browse all 22133

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>