strong/weak typing and pointers
Diez B. Roggisch
deetsNOSPAM at web.de
Thu Nov 4 13:14:10 EST 2004
> Does this make my concern any clearer? What I'm asking for is an example
> like yours above that not only shows that you can treat, say, the bits of
> a float as an integer, but also shows why this would be useful.
The question is not so much if there is an actual usecase, but more that if
things _can_ be done, they inevitably _will_ be done. People have done so
all the time. I can remeber abusing 32bit pointers in 68k processors by
altering the most-significant byte. It took advantage of the fact that the
old 68k had only 24 address registers, thus ignoring the msbyte. That
allowed to pass 2 parameters in one pointer. And was for a short period of
time considered a clever trick....
Today, with lots of memory and faster processers, certain optimization
techniques that required creative reinterpretaiton of bits might have come
somewhat out of fashion - but the more low-level you get (e.g. drivers or
embedded devices) the more appaling they might look.
--
Regards,
Diez B. Roggisch
More information about the Python-list
mailing list