comp.lang.c
[Top] [All Lists]

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

Subject: Re: Is cast operator unary or binary? How many operands?
From: jacob navia
Date: Wed, 30 Apr 2008 16:34:53 +0200
Newsgroups: comp.lang.c


Richard Tobin wrote:
In article <fv9s2t$mu7$1@xxxxxxxx>, jacob navia  <jacob@xxxxxxxxxx> wrote:

When I write

(double)i;

I am conceptually calling

double TransformIntegerToDouble(int);

Why are you not conceptually calling Transform(int, double)?

-- Richard

Because the "int" is the RESULT type, not the input type!

Besides, a hyper hyper generic procedure:
        Transform(anything,anything)
is just a dream...

You can have only concrete procedures:

        Something TransformToSomething(something_else);

TransformIntegerToDouble exists (at least in lcc-win),
and will take care of the details, correct rounding, etc etc.

Transform(int,double) doesn't exist and can't exist since
it would have to take ANY two input types and transform the
second into the first, an impossible task!


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

<Prev in Thread] Current Thread [Next in Thread>
Privacy Policy