Matthew Woehlke wrote:
...but this ("typeof(&((b)[0]))") seems like it might work, assuming
that "b" is a string literal, a [const] char*, or a [const] char[].
Yes, in fact, this does seem to work:
#define S_OR(a, b) ({typeof(&((a)[0])) __x = (a); ast_strlen_zero(__x) ?
(b) : __x;})
This macro appears to work fine, compiles in all our existing usage
situations (combinations of char *, char [], const vs. non-const) and
provides the side-effect-safe evaluation of its arguments I was looking
for in the first place. Thanks!