Designated initializers for ObjC?

Ovidiu Predescu ovidiu@cup.hp.com
Tue Dec 5 20:20:00 GMT 2000


I don't see where this could be a problem either. The message passing doesn't
use ellipsis at all, so it cannot possibly conflict with it. Something else
should have caused the author of the change to comment it out.

Regards,
Ovidiu

On Tue, 05 Dec 2000 18:00:52 -0800, Stan Shebs <shebs@apple.com> wrote:

> There's a strange little conditional in c-parse.in that effectively
> removes designated initializers from Objective-C:
> 
>         /* These are for labeled elements.  The syntax for an array element
>            initializer conflicts with the syntax for an Objective-C message,
>            so don't include these productions in the Objective-C grammar.  */
> ifc
>         | '[' expr_no_commas ELLIPSIS expr_no_commas ']'
>                 { set_init_index ($2, $4);
>                   if (pedantic)
>                     pedwarn ("ISO C forbids specifying range of elements to ini\
> tialize"); }
>         | '[' expr_no_commas ']'
>                 { set_init_index ($2, NULL_TREE); }
> end ifc
> 
> This is obviously a problem for anyone that wants to use this
> extension in ObjC programs.  My question is: why is it disabled?
> I enabled this and noodled around a bit with example code; the
> message-passing case and the designator case don't ever seem to
> validly overlap, for instance you can't have a message send
> inside an initializer because it's not a constant, and so far
> the parser has been giving reasonable error messages.
> 
> Before proposing the patch, I'm going to test this on at least
> some of Apple's million+ lines of ObjC source, but in the meantime,
> I'd like to know if I'm missing the reason for this.  It's been
> in there for quite some time, since 2.7 at least, so maybe it's
> just another hysterical leftover?
> 
> Stan
> 




More information about the Gcc mailing list