[coreboot] Shortened in types (u32) vs stdint types (uint32_t)
mr.nuke.me at gmail.com
Wed Jan 29 21:05:20 CET 2014
A lot of great opinions from both sides. I have created a small entry into our coding
guidelines describing this debate .
I've prepared a small summary of the three coding styles we are using with respect to
Older than grandma grandma current
------------------ ------- -------
unsigned long long u64 uint64_t
long long ??? int64_t
unsigned long u32 uint32_t
long ??? int32_t
I have seen zero lobbying for "Older than grandma", which is good. The debate
remains between "grandma" and "current".
The main issue here is consistency. Having both styles is bound to clash sometime in
the future. We have code that calls "current" functions and stores the result into
"grandma" variables. I doubt carrying on both styles is a good idea in the long term.
I feel awkward lobbying for "current" considering I almost had a aneurysm when I first
stumbled on usage stdint types in coreboot. Since then, I've started doing minor
refactoring on our userspace tools, and lo and behold, we have duplicate files for
userspace and coreboot. One example is the lzma decompressor, whose userspace
counterpart I am currently refactoring.
Userspace is stdint, no debate about it. So what happens when I take the refactored
decompressor, and put it in coreboot proper? For consistency's sake, I would have to
change "current" types to "grandma" types, which is, in plain english, an imperial pain
in the poop hole. This is the exact argument Aaron and Peter are making, and it is the
only practical argument I have seen thusfar.
We're not linux, so the linux-legacy argument fails right off the bat, in my view.
The other practical argument is finger strain from typing the "_t". I used to be a strong
believer in that, until a bunch of other projects told me to "suck it up". Seriously, use a
good editor, and it will autocomplete the "_t" for you. You'll soon find that looking at
code for hours at a time is a lot more comfortable, and less eye-straining. "u32" is just
too short to be eye-friendly.
I'd like end by quoting my favorite part of this discussion:
> Seriously though, you'll *get over that* really quickly if you start
> using C99 standard types as a matter of routine. Your fingers don't take
> that long to learn, as a one-off.
> But yes, you highlight the issue which is caused by people clinging to
> their own *nonsense*, *non-standard* types instead of using the language
> properly. Your fingers have to be retrained every time you switch
> between projects.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the coreboot