|
From: | Christian Jullien |
Subject: | [Tinycc-devel] RE: size_t badly redefined in time.h for _WIN64 |
Date: | Mon, 21 Dec 2009 16:49:20 +0100 |
I also noticed that size_t size varies #include
<stddef.h> int s1() { size_t
i; return(sizeof(i)); } #include
<time.h> int s2() { size_t
i; return(sizeof(i)); } int main() { printf("before
time.h: %d\n", s1()); printf("after
time.h: %d\n", s2()); } Outputs: before time.h: 4 after time.h: 8 It means that __SIZE_TYPE__ is not
correctly defined for 64bit #ifdef
TCC_TARGET_X86_64
tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned long
long"); #else
tcc_define_symbol(s, "__SIZE_TYPE__", "unsigned long"); #endif From: Christian
Jullien [mailto:address@hidden foo.c: #include
<stddef.h> static void
foo(size_t); #include
<time.h> // after time.h
is included, size_t is not of the same type static void
foo(size_t unused) {} tcc foo.c foo.c:4: error:
incompatible types for redefinition of 'foo' Changing by: #ifndef
_SIZE_T_DEFINED #define
_SIZE_T_DEFINED #undef size_t typedef
__SIZE_TYPE__ size_t; #endif Fix the error since
it is the way it is defined in stddef.h And add #define
_SIZE_T_DEFINED In stddef.h C. |
[Prev in Thread] | Current Thread | [Next in Thread] |