Re: Delay Routine: Fully-portable C89 if possible



Everett M. Greene wrote:

Does anyone have a public domain copy of stdint.h?

Impossible. The interface provided by <stdint.h> is standardized --- but it's actual content isn't, and can't be.

If portable code could define uint32_t itself, there would be no point for <stdint.h> to exist. This header *has* to be either provided by the compiler writer, or tailored to a particular compiler by an informed programmer.

Any number of people speak of rolling their own, but that seems a
little silly if it's advocated that as many people as possible use
stdint.h.

The point is that you should only roll your own if the compiler authors didn't provide on. But if you *are* going to roll your own, it's a good idea to roll your own along the lines of the standard version, rather than inventing yet another set of my_u32 types.

One of the problems this would avoid involves libraries from several independent vendors all used in the same project, who each thought they should roll their own type names for this, instead of following the C99 guidelines. The inevitable result is that two of them chose the *same* names, and now you get to resolve type redefinitions among other people's header files. Great fun --- not!
.



Relevant Pages

  • Re: C54X C structure packing
    ... Roll your own convertor of a structure to an array of bytes and back; ... with explicit conversion of each of the fields. ... The other processor's compiler uses #pragma ... compiler does not support packing and returns inflated sizeof value in ...
    (comp.dsp)
  • Re: C54X C structure packing
    ... Roll your own convertor of a structure to an array of bytes and back; ... with explicit conversion of each of the fields. ... The other processor's compiler uses #pragma ... compiler does not support packing and returns inflated sizeof value in ...
    (comp.dsp)
  • Re: -Crawl- ERRATA: Dungeon Crawl Stone Soup 0.1.3. release announcement
    ... end-user to roll their own". ... The 0.1.3 level compiler operates only ...
    (rec.games.roguelike.misc)