Add size_t ssize_t and socklen_t

This commit is contained in:
2025-04-29 15:36:43 -04:00
parent 42268b6cc2
commit 37bf95704e
5 changed files with 60 additions and 56 deletions

23
int.h
View File

@@ -23,15 +23,17 @@ typedef uint64_t uintptr_t;
#elif __WORDSIZE == 32
typedef int32_t intptr_t;
typedef uint32_t uintptr_t;
#else
#error Unsupported or unknown wordsize
#endif
typedef intptr_t ssize_t;
typedef uintptr_t size_t;
typedef uint32_t socklen_t;
typedef uint32_t pid_t;
// Compile time tests in supported compilers
#ifdef __SIZEOF_CHAR__
#if __SIZEOF_CHAR__ != 1
#error __SIZEOF_CHAR__ is not 1
#endif
#endif
#ifdef __SIZEOF_SHORT__
#if __SIZEOF_SHORT__ != 2
#error __SIZEOF_SHORT__ is not 2
@@ -56,7 +58,10 @@ typedef uint32_t uintptr_t;
#endif
#endif
// TODO:
// size_t, ssize_t, socklen_t
// #ifdef __SIZEOF_SIZE_T__
#ifdef __SIZEOF_SIZE_T__
#if __SIZEOF_SIZE_T__ != (__WORDSIZE / 8)
#error __SIZEOF_SIZE_T__ is not (__WORDSIZE / 8)
#endif
#endif
#endif // !MINIMALINT_H