It was thus said that the Great David Riley once stated:
On Jul 2, 2012, at 6:53 PM, Sean Conner wrote:
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).
But it's not defined in a standard, which is a problem. It could be 128
bits when it's compiled for all you know.
Um .. it *IS* defined in a standard---the ANSI C standard:
... Their implementation defined values shall be equal or greater in
magnitude (absolute value) to those shown, with the same sign.
CHAR_BIT - number of bits for smallest object that is not a
bit-field (byte)
CHAR_BIT 8
(C Standard, section 5.2.4.2.1)
> have none of that uncivilized "uint32_t"
bullshit that these kids have
> dreamed up...and, surprise, my code is VERY portable)
Well, that "uint32_t" crap is *very* useful for networking protocols or
binary file parsing.
And elsewhere. I can't count the number of places crypto code broke
on my first-gen Opteron system under Linux because the folks who
wrote the standard MD5 code assumed that "unsigned long" was always
32 bits. They didn't even have a halfway decent excuse, since alpha
and sparc64 had been around quite a while.
True. I've been playing around with viola [1] and it *barely* works on a
modern system and won't at all on a 64 bit system, due to the "an int is a
pointer is a long" mentality of the code. Ick.
-spc (It looks like it started out life as K&R C, with some small token
attempts towards ANSI C ... )
[1] One of the first graphical web browsers from around 1992. It has a
number of concepts which are in use today, including style sheets
(not compatible with CSS), scripting (its own language, not
JavaScript) and some that are not, such as the ability to traverse
the object model/source code (like Smalltalk or Hypercard
environments).