David,

--- David Ayers <[EMAIL PROTECTED]> wrote:

> Gregory John Casamento schrieb:
> > Please find the attached patch.
> > 
> > Basically, it just coerces all of the problem places to id prior to
> coercing it
> > to GSIMapVal/GSIMapKey/etc.  This fixes the problem, but I'm not sure it's
> the
> > cleanest solution.
> > 
> > I ran a test recently on gcc 3.4.3, using the attached simple test.c
> program.  
> > I got the following:
> > 
> > [EMAIL PROTECTED] heron]$ gcc -o testa test.c 
> > test.c: In function `main':
> > test.c:16: error: cast to union type from type not present in union
> 
> H'm...
> 
> > 
> > #include <stdio.h>
> > 
> > typedef union {
> >   int x;
> >   void *y;
> > } test_union;
> > 
> > void foo(test_union a)
> > {
> >   puts("here");
> > }
> > 
> > int main(char *argv[], int argc)
> > {
> >   long a = 1024; // somevalue...
> >   foo((test_union)a);
> > 
> 
> but this is not what we are doing, as long and int are distinct types.
> As you noticed this would have been an error in previous versions of GCC.

As are, id and NSObject*, depeding on how you look at it.
 
> In our case there are the special ObjC semantics that any objects could
> be matched to 'id'.  And even if 'id' were not present and only
> "NSObject *" were, then the compiler should use that for any
> identifiable subclass of NSObject.

I do see your point about this.  But when dealing with casting unions, which is
a gcc extension, I'm not certain if we can make a case for this.
 
> I would tend to agree with Richard that this is a compiler bug and maybe
> we should add something like the attached test case to gcc...
> 
> Andrew?
> 
> Cheers,
> David

Later, GJC

Gregory John Casamento 
-- CEO/President Open Logic Corp. (A MD Corp.)
## Maintainer of Gorm (IB Equiv.) for GNUstep.


_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to