This is the mail archive of the
mailing list for the GCC project.
Re: builtin_types_compatible_p and const
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: Daniel Egger <degger at fhm dot edu>,GCC Developer Mailinglist <gcc at gcc dot gnu dot org>,Joseph Myers <jsm28 at cam dot ac dot uk>
- Date: Mon, 25 Feb 2002 23:49:40 -0500
- Subject: Re: builtin_types_compatible_p and const
- References: <1014644318.4393.2.camel@sonja> <B0C6B900-2A49-11D6-B487-000393750C1E@redhat.com>
On Tue, Feb 26, 2002 at 10:45:04AM +1100, Aldy Hernandez wrote:
> On Tuesday, February 26, 2002, at 12:38 AM, Daniel Egger wrote:
> >Am Mon, 2002-02-25 um 03.03 schrieb Aldy Hernandez:
> >>first, vec_lvsl accepts "char *" not "const char *", so you'll
> >>have to cast.
> >That's about the most annoying thing. What's wrong about loading
> >from a constant address?
> i agree, let's summon the expert again...
> joseph, i agree with daniel. the code below should compile, but
> x and y are not compatible according to the builtin. are there
> any objections to making a patch to fix this?
> const char *x;
> char *y;
> int foo[__builtin_types_compatible_p (__typeof(x), __typeof(y)) == 1 ?
> 1 : -1];
- at that point, you're not really dealing with type compatibility any
more. They aren't compatible as I understand it; but under default
promotions they can be.
- You then need to distinguish the arguments to
__builtin_close_enough_p or whatever it becomes.
__builtin_close_enough_p (const char *, char *)
may be OK, but what about:
__builtin_close_enough_p (char *, const char *)
Daniel Jacobowitz Carnegie Mellon University
MontaVista Software Debian GNU/Linux Developer