Re: Is cast operator unary or binary? How many operands?



JoseMariaSola wrote:
How may operators and operands does (typename) expression has?

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?

Thanks.

José María.

It has one argument: the expression, and a *result*
of type "typename"

When I write

(double)i;

I am conceptually calling

double TransformIntegerToDouble(int);

a function that takes ONE integer argument and outputs
a double number. Obviously there is no such a function
since the compiler inlines this cast when compiling, but
in some cases an actual function call will be generated.



--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
.



Relevant Pages

  • Re: Runtime type cast in C#
    ... this is is defined by the typename string: ... > If you have a reference to the type, then yes, you can, just cast the ... > that loads and creates the type, you cast the return value to the interface, ...
    (microsoft.public.dotnet.languages.csharp)
  • Runtime type cast in C#
    ... I want to cast an object that I have created from a typename to the ... Can anycone tell me how to do this? ... Create the object of type "MyClass" ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Code problem
    ... I don't see any cast to unsigned int in the above program. ... I was missing the sign extend in the process. ... jacob at jacob point remcomp point fr ...
    (comp.lang.c)
  • Re: Common misconceptions about C (C95)
    ... caught by the compiler. ... pointer of type other than void*), you need the cast. ... I disagree with jacob on the importance of writing C that's also ... dislike, you feel the need to bring up something else about jacob ...
    (comp.lang.c)
  • Code problem
    ... extern void abort; ... I cast the 32 bit integer -3 into an unsigned integer ... jacob at jacob point remcomp point fr ...
    (comp.lang.c)