GCC has a statment expression feature that allows macro to be defined as:
#define maxint(a,b) \
({int _a = (a), _b = (b); _a > _b ? _a : _b; })
This is illegal in Visual Studio.
Is there an equivalent feature in microsoft visual studio? (I know, I would better use GCC. But I am just curious).
Or, do we just have to resort to inline functions?
If you were using C++, I believe a lambda function could be used:
#define maxint(a,b) \
([=] () {int _a = (a), _b = (b); return _a > _b ? _a : _b; }())
There is no equivalent in the MS compiler to this non-standard GCC language extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With