Re: Is cast operator unary or binary? How many operands?
- From: JoseMariaSola <JoseMariaSola@xxxxxxxxx>
- Date: Wed, 30 Apr 2008 04:43:29 -0700 (PDT)
On Apr 29, 5:31 pm, rich...@xxxxxxxxxxxxxxx (Richard Tobin) wrote:
In article <13115f63-fd53-4436-879d-4dab6f0fc...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
JoseMariaSola <JoseMariaS...@xxxxxxxxx> wrote:
But in the case of cast the (only) operand is the expression the left,
not the type-name.
I see, you want to consider, say, (int) as an operator with a single
operand, rather than (int)x containing an operator with two operands,
"int" and "x".
This would imply an infinite number of operators, which is not
out of the question but doesn't seem to offer any advantage.
Talking with you both I notice that every operator requires
expressions as operands, and type-name is not an expression. Am I
right?
The two traditional uses of "( type-name )" - in casts and sizeof -
and the new use in C99 - in compound literals - are indeed
exceptional. I previously suggested that we could factor out
type-expression:
( type-name )
which would make sizeof in particular more regular:
unary-expression:
...
sizeof unary-expression
sizeof type-expression
-- Richard
--
:wq
Thanks, Richard.
So both following expressions have one operator and one operand?
sizeof(int)
(int)x
typename is considered an operand in the firs expressin but not in the
second one?
JM.
.
- Follow-Ups:
- Re: Is cast operator unary or binary? How many operands?
- From: Chris Torek
- Re: Is cast operator unary or binary? How many operands?
- From: Richard Tobin
- Re: Is cast operator unary or binary? How many operands?
- References:
- Is cast operator unary or binary? How many operands?
- From: JoseMariaSola
- Re: Is cast operator unary or binary? How many operands?
- From: JoseMariaSola
- Re: Is cast operator unary or binary? How many operands?
- From: Richard Tobin
- Re: Is cast operator unary or binary? How many operands?
- From: JoseMariaSola
- Re: Is cast operator unary or binary? How many operands?
- From: Richard Tobin
- Is cast operator unary or binary? How many operands?
- Prev by Date: Re: ubuntu and its C compiler
- Next by Date: Temporarily close stdout?
- Previous by thread: Re: Is cast operator unary or binary? How many operands?
- Next by thread: Re: Is cast operator unary or binary? How many operands?
- Index(es):
Relevant Pages
|