It was thus said that the Great Tony Duell once stated:
As a
digression, normally, assuming programming in C, you'd place a
"unsigned short" variable at the address of the SPI data register. (I'll
AFAIK sizeof(unsigned short) is not defined anywhere :-).
I'm not sure I follow you here. In C, you can indeed do a
sizeof(unsigned short)
and get back the size (in characters) of a short int (with the size in bits
of a character defined by CHAR_BIT).
Of course you can. The point I was making is that the value you get
depends on the compiler/architecture. There is no reason why a char (or
unsigned char) has to be 8 bits, there is no reason why a short is 2
chars, etc.
Therefore if you are using this to talk to soem hardware register that is
physcially a 16 bit register the resulting code is not portable. Of
course the fact that it depends on a particular bit of hardware probably
makes it non-portably too.
-tony