On Nov 9, 2010, at 2:07 AM, Kyle Sluder wrote:
> On Mon, Nov 8, 2010 at 9:06 AM, Gerriet M. Denkmann <gerr...@mdenkmann.de>
> wrote:
>> typedef char *(*my_type)(const char *, int);
>> my_type some = index;
>> fprintf(stderr,"sizeof(index): %lu\n", sizeof(index));
>> fprintf(stderr,"sizeof(some): %lu\n", sizeof(some));
> 
> 1. This is not a Cocoa question.
> 2. sizeof of an expression of function type is illegal according to
> constraint 1 of section 6.5.3.4 of C99:
> http://www.open-std.org/jtc1/sc22/WG14/www/docs/n1256.pdf

sizeof an expression of pointer-to-function-type is legal, however. Values of 
function type are usually automatically converted to pointer-to-function-type, 
but sizeof is one of the exceptions (6.3.2.1).

This will print the value you expect:
    fprintf(stderr,"sizeof(&index): %zu\n", sizeof(&index));


-- 
Greg Parker     gpar...@apple.com     Runtime Wrangler


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to