>On Thu, 15 Jan 2004 19:02:27 +0100, Yacine <>
>wrote:
[snippage]
>> double x;
>> double *y;
>> (int) y = x;
In article <>
Horst Kraemer <> writes:
>Your compiler uses some extension to the C language.
This much is reasonably clear (the other "likely" possibility is that
his compiler is simply broken

).
>In C the first assignment may be written as
>
> *(int*)&y = x;
Note that one popular compiler that adds a "cast as lvalue" rule,
the GNU C Compiler (gcc), defines cast-as-lvalue *very* differently.
The assignment to (int)y is not equivalent to the above, but rather
to the (syntactically valid but semantically dodgy) ANSI/ISO C code:
(int)(y = (double *)(int)&x)
>> (double) y = x;
>and the second as
> *(double*)&y = x;
Gcc would define this as:
(double)(y = (double *)(double)&x)
which would then draw a complaint ("pointer value used where a
floating point value was expected").
For more details on gcc's weird sort-of-like-C language GNUC (which
I pronounce as "ganuck", more or less), see "info gcc", assuming
the info files have been installed along with the compiler. The
definition of lvalue-as-cast is under "C Extensions" and then
"Lvalues".
--
In-Real-Life: Chris Torek, Wind River Systems
Salt Lake City, UT, USA (40°39.22'N, 111°50.29'W) +1 801 277 2603
email: forget about it
http://web.torek.net/torek/index.html
Reading email is like searching for food in the garbage, thanks to spammers.