Ok Tom, are you ready for some geek? I am the βseniorβ guy in this world of young shooters. However, I remember a few things about C, and I'm just a geek at heart.
In any case, there is a slight difference between this:
typedef struct { double d1, d2; } Foo1;
and this:
typedef struct Foo2 { double d1, d2; } Foo2;
The first is a type alias for an anonymous structure. The second is an alias of type struct Foo2 .
Now the documentation for @encode states that the following:
typedef struct example { id anObject; char *aString; int anInt; } Example;
will result in { example=@ *i} for @encode(example) or @encode(example) . So this means that @encode uses the actual structure tag. In the case of a typedef that creates an alias for the anonymous structure, it looks like this: @encode always returns ? ''
Check this:
NSLog(@"Foo1: %s", @encode(Foo1)); NSLog(@"Foo2: %s", @encode(Foo2));
In any case, can you guess how CLLocationCoordinate2D is determined? Yeah. You guessed it.
typedef struct { CLLocationDegrees latitude; CLLocationDegrees longitude; } CLLocationCoordinate2D;
I think you should submit a bug report. Either @encode broken because it does not use alias typedefs for anonymous structures, or CLLocationCoordinate2D must be fully typed, so it is not an anonymous structure.