A fast and compact way to initialize a structure is to enclose the values in a 
pair of braces like this.

     NSRect rect = {{0,0},{80,20}};
     NSView *view = [[NSView alloc] initWithFrame:rect];

However a compiler error occurs if we try to initialize a struct with braces 
directly within an Objective-C message.

     NSView *view = [[NSView alloc] initWithFrame:{{0,0},{80,20}}];

Why does the compiler accept the first but not the second?

Richard Charles
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to