|
|
On Apr 29, 2:18 pm, rich...@xxxxxxxxxxxxxxx (Richard Tobin) wrote:
> In article <5c21f815-e1e6-468e-8630-cc72dad60...@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
>
>
>
> JoseMariaSola <JoseMariaS...@xxxxxxxxx> wrote:
> >Here is part of the grammar:
>
> >unary-expression:
> > postfix-expression
> > ++ unary-expression
> > -- unary-expression
> > unary-operator cast-expression
> > sizeof unary-expression
> > sizeof ( type-name )
>
> >unary-operator: one of
> > & * + - ˜ !
>
> >cast-expression:
> > unary-expression
> > ( type-name ) cast-expression
>
> >Why sizeof, (type-name), ++ and -- aren't unary-operators?
>
> You could include sizeof in unary-operator, but you'd still need the
> special case of a type-name operand requiring parentheses, and it
> seems clearer to keep them together in the list. Similarly ++ and --
> would still have to appear in postfix-expression. Both of these are
> just matters of taste really.
> I don't see how you could do
> (type-name), because a unary-operator is something that precedes its
> operand, and the parentheses of a cast have to go around the operand.
But in the case of cast the (only) operand is the expression the left,
not the type-name.
Talking with you both I notice that every operator requires
expressions as operands, and type-name is not an expression. Am I
right?
JM.
|
|