Posted Jun 2, 2007 18:56 UTC (Sat) by giraffedata
In reply to: long long
Parent article: The return of syslets
A key point is that even if you do have to create your own defs, at least name them after the stdint.h types
You have to do substantially more work if you want to do that, because you have to make sure nobody else defines the type. If you just do something as simple as checking __STDC_VERSION__, you can't then do a typedef of uint32_t, because it might be defined even though the environment is not totally C99.
And if it's part of an external interface, you surely have no right to define as generic a name as uint32_t. It could easily conflict with header files from other projects that had the same idea.
so that you can later switch without pain
The "switching" that I think is most important is where someone extracts your code for use in a specific environment where uint32_t is known to be defined. That's why I do all that extra work to be able to use uint32_t (and I don't claim that I've got it right yet) instead of a private name for the same thing.
to post comments)