What is Expressiveness in a Computer Language

Darren New dnew at san.rr.com
Tue Jun 20 13:02:23 EDT 2006


Rob Thorpe wrote:
> The compiler
> relys entirely on the types of the variables to know how to correctly
> operate on the values.  The values themselves have no type information
> associated with them.

int x = (int) (20.5 / 3);

What machine code operations does the "/" there invoke? Integer 
division, or floating point division? How did the variables involved in 
the expression affect that?

>>Casting in C takes values of one type to values of another type.

> No it doesn't. Casting reinterprets a value of one type as a value of
> another type.

No it doesn't.
int x = (int) 20.5;
There's no point at which bits from the floating point representation 
appear in the variable x.

int * x = (int *) 0;
There's nothing that indicates all the bits of "x" are zero, and indeed 
in some hardware configurations they aren't.

-- 
   Darren New / San Diego, CA, USA (PST)
     My Bath Fu is strong, as I have
     studied under the Showerin' Monks.



More information about the Python-list mailing list