Content originally posted in LPCWare by MarcVonWindscooting on Sat Jun 21 03:41:55 MST 2014
Quote: Pacman
-What I meant was the code that relies on it.
My guess is that you would need the pointer size, because you need to convert a pointer to an integer or an integer to a pointer.
...
Recently I try to avoid casting between pointers and integers. Especially strict aliasing awareness changed my way of dealing with pointers. Nowadays I prefer that 'array access' style. Or else the 'pointer+index' (or ++), with index not beeing byte offset but rather an element count.
IIRC the very origin of the code was the wish to display some pointer values for debugging, which involved passing a suitable integer type to a hexadecimal output function. Casting to Uint32 wasn't suitable any more on my first 64bit machine.
Another part is seqio.h - the abstract workhorse for my I2C drivers. There, I needed some integer type that can hold data but sometimes a pointer instead. I could/should have used a union instead, maybe.
There is very, very little code dependend on the pointer size.
Some parts of the library are rather old (6+ years) and sometimes I wonder, what that guy (me, really ??? :~ ) had been thinking at that time....
But for one thing, I stick to single byte calculation: Initialization of buffer size fields of structures. I mean, if I will ever implement a (object-oriented like) Stack of 8-byte pointers in C, then the initialization will most probably set the allocated buffer size measured in bytes, not as the total number of pointers. Just because passing 'sizeof buffer' is so handy :)