This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: __builtin_types_compatible_p and 'char *' vs. 'char []'
- From: Matthew Woehlke <mw_triad at users dot sourceforge dot net>
- To: gcc-help at gcc dot gnu dot org
- Date: Thu, 06 Nov 2008 17:06:19 -0600
- Subject: Re: __builtin_types_compatible_p and 'char *' vs. 'char []'
- References: <49131E88.3010500@digium.com>
Kevin P. Fleming wrote:
There is one workaround that I've found, which is to call the macro like
this:
char str1[20], *str2;
....
str2 = S_OR(&str1, "");
This makes the 'promotion' to 'char *' explicit, and resolves the issue.
...but isn't the code wrong? typeof(&str1) =~ char**, not char*?
What about this (untested WAG):
typeof(*(&a)) __x = a;
- or -
typeof(&(a[0])) __x = a; // a must be pointer or array
--
Matthew
Please do not quote my e-mail address unobfuscated in message bodies.
--
In the beginning, there were not enough colors. -- Guy Keren