August 1, 2025
Sun 3 bootrom souce - Some talk about types
Integer types and the C language have always been an important and
interesting topic. The trouble is that short, int, and long have
no well defined meaning. They can (and do!) change from architecture
to architecture as well as from compiler to compiler.
long
I am somewhat surprised by the frequent use of "long" in the bootrom
code. And the use is inconsistent as well, sometimes "int" is used
and other times "long" when in both cases a 32 bit item is desired.
Some of this mystery is resolved by remembering the state of things
in 1987. Sun was moving from the sun2, which was sort of a 16 bit
machine and sort of a 32 bit machine. At the time "long" seemed
like an explicit way to say that you wanted a 32 bit value, and
seemed just a little extravagant. Nobody even though about 64 bit
values.
Subroutine aguments
Sometimes I see subroutines with arguments typed as "char" or "short".
I always think that this is a misguided effort to somehow save memory.
It is my opinion that these should just be "int" and be done with it,
but I need to conduct some experiments to verify that this is true.
Stay tuned.
Feedback? Questions?
Drop me a line!
Tom's Computer Info / tom@mmto.org