Re: rules for __builtin_types_compatible_p??

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kevin P. Fleming wrote:
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;})

Ah, simplification ;-).

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!

You're welcome! (Now, if only I knew why that odd incantation is needed... :-) )

--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
When in doubt, give it a good swift kick.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux