void * and & and C lameness
I don't know who specified it, but that you can't use
&
on pointers is a major lameness in C. Especially
with addresses you want to mask off bits, and you now always have
to cast to an integer and then back again. The problem is though,
which integer ? Traditionally on UNIX one used int, but
that f.e. never worked well on the Atari ST f.e., where int was
defined on some compilers to be 16 bit. With the advent of 64 bit
computing, it remains to be seen if all compilers will promote
long
to 64 bit, so logically one should be using
unsigned long long
, but that is just horrible :)
One reason, why you may not be able to use &
on
pointers, might be because you couldn't use AND on address
registers on some CPUs like the 680000. but then C was developed
for the PDP-11 and I don't know that machine at all. It is also
none none none convenient, that you can't say (void *) p +
12. I suspect some PASCALers were on the committee when this
was discussed. :) [Playing right now: Gasoline from the
album "Audioslave" by Audioslave]
Post a comment
All comments are held for moderation; basic HTML formatting accepted.