Sujet : Re: Suggested method for returning a string from a C program?
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 20. Mar 2025, 20:22:30
Autres entêtes
Organisation : None to speak of
Message-ID : <87v7s3se15.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Gnus/5.13 (Gnus v5.13)
bart <
bc@freeuk.com> writes:
[...]
They're popular everywhere:
>
typedef uint32_t Uint32; // from SDL2
>
typedef unsigned int GLuint; // from OpenGL
>
typedef unsigned int l_uint32; // from Lua
>
typedef unsigned int mz_uint32; // from MiniZ compression lib
>
typedef uint32_t stbi__uint32; // from STB image library
>
typedef uint8_t byte; // from arduino.h
>
#ifndef UINT32_TYPE // from SQLite3
# ifdef HAVE_UINT32_T
# define UINT32_TYPE uint32_t
# else
# define UINT32_TYPE unsigned int
# endif
#endif
[...]
So I have to ask, why do think they do that?
Almost certainly because they were originally implemented when
<stdint.h> was not universally available. It took a number of
years after the publication of C99 before it was safe to assume
that published code would never be compiled with a C90 compiler.
In a new open source project starting today, it would make much
more sense to use the <stdint.h> types directly. But removing
the project-specific typedefs now would break existing code that
depends on them.
[...]
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */