Error in Declarator definition ?

Chris Nicholson-Sauls ibisbasenji at gmail.com
Mon Feb 19 12:55:29 PST 2007


Jarrett Billingsley wrote:
> "Carlos Smith" <carlos-smith at sympatico.ca> wrote in message 
> news:erbfh1$1jpv$1 at digitalmars.com...
>> Hi,
>>
>> In the grammar for Declarations,
>>  http://www.digitalmars.com/d/declaration.html
>> there is:
>>
>> Declarator:
>> BasicType2 Declarator
>> Identifier
>> () Declarator
>> Identifier DeclaratorSuffixes
>> () Declarator  DeclaratorSuffixes
>>
>> the "() Declarator" parts, are they Ok ?
>>
>> Should that be written "( Declarator )" instead ?
>>
>> Carlos
>>
> 
> Yep.  There have been a few of these misplaced parens since the spec was 
> moved over to DDoc.
> 
> Although, what is this syntax for?
> 
> int (x) = 5;
> writefln(x);
> 
> This works.  Why would you want to put parens there? 
> 
> 

The only thing I can think of is support for C-style function pointer declerations, but I 
thought we wanted to move away from those...  The compiler still accepts and comprehends 
them, though.

-- Chris Nicholson-Sauls


More information about the Digitalmars-d-learn mailing list