Re: Is cast operator unary or binary? How many operands?
- From: vippstar@xxxxxxxxx
- Date: Tue, 29 Apr 2008 05:56:58 -0700 (PDT)
On Apr 29, 3:45 pm, JoseMariaSola <JoseMariaS...@xxxxxxxxx> wrote:
How may operators and operands does (typename) expression has?(typename)(expression) has one operator `(typename)' and one operand
I'd say one operator, the cast operator, and two operands: typename
and expression.
But everywhere I read, cast is categorized as an unary operator. Why
is that? Is it just a syntax cotegory?
`(expression)'.
The reason the type is enclosed in parentheses (as a design decision)
is probably to avoid ambiguity, consider this:
int i = 1; /* define and initialize i to 1 */
{
int i; /* cast i to int, a statement with no effect, or define i in
block scope? */
}
.
- Follow-Ups:
- Re: Is cast operator unary or binary? How many operands?
- From: JoseMariaSola
- Re: Is cast operator unary or binary? How many operands?
- References:
- Is cast operator unary or binary? How many operands?
- From: JoseMariaSola
- Is cast operator unary or binary? How many operands?
- Prev by Date: Is cast operator unary or binary? How many operands?
- Next by Date: "Change your language and you change your thoughts."
- Previous by thread: 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
|
|