diff options
| author | 2024-10-06 13:32:00 -0400 | |
|---|---|---|
| committer | 2024-10-06 13:32:00 -0400 | |
| commit | e6710f5ad898b54a4ae74d57858ba1287f0ef8bf (patch) | |
| tree | 8c6903227735f59e8a821cca8b4aa4e0a1a6816b /src | |
| parent | c682feffb0a6cde943687587721f2603b3846ceb (diff) | |
| download | libalabaster-e6710f5ad898b54a4ae74d57858ba1287f0ef8bf.tar.gz libalabaster-e6710f5ad898b54a4ae74d57858ba1287f0ef8bf.tar.bz2 libalabaster-e6710f5ad898b54a4ae74d57858ba1287f0ef8bf.zip | |
lib: Cleanup types and assert sizeof(int) = 4
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1,5 +1,12 @@ #include "../include/al/lib.h" +// https://forum.vcfed.org/index.php?threads/c-item-size-check-at-compile-time.1244920/ +#define AL_ASSERT_TYPE_SIZE(type, size) \ + typedef char type##__size_test[( !!(sizeof(type) == size) )*2-1] + +AL_ASSERT_TYPE_SIZE(int, 4); +AL_ASSERT_TYPE_SIZE(unsigned, 4); + #if AL_USE_STDLIB static void *(*_al_malloc)(size_t) = malloc; static void *(*_al_calloc)(size_t, size_t) = calloc; |