Testing if an expression has side effects at compile time
Florian Weimer
fweimer@redhat.com
Fri Jan 9 13:37:52 GMT 2026
* Alejandro Colomar via Gcc:
> If there's no way, it would be interesting to add compound literals of
> function type to achieve this:
>
> #define strnulD(...) \
> ((static inline auto \
> (auto s)) \
> { \
> return s + strlen(s); \
> }(__VA_ARGS__))
This already works:
static inline auto
strnulD (auto s)
{
return s + strlen (s);
}
No need to invent new syntax for it.
Thanks,
Florian
More information about the Gcc
mailing list