Re: __builtin_types_compatible_p and 'char *' vs. 'char []'

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

 



Matthew Woehlke wrote:

> static inline s_or(char* a, char* b) {
>   return ast_strlen_zero(a) ? b ? a);
> }
> static inline s_or_const(const char* a, const char* b) {
>   return ast_strlen_zero(a) ? b ? a);
> }
> #define S_OR(a,b) \
> __builtin_choose_expr( \
>   __builtin_types_compatible_p(typeof(a), char*) && \
>   __builtin_types_compatible_p(typeof(b), char*), \
>   s_or(a,b), s_or_const(a,b))

Unfortunately the documentation says the 'compatible determination
ignores attributes like const, volatile, etc. I'll give it a try though,
it's easy enough to test.

-- 
Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM)

[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