In said:
I suppose you mean the Sun C compiler
that you got bundled with Solaris 2.6?
I don't mean to quibble but
you haven't actually shown that size_t gets defined in stdlib.h
Try to compile
#define _SIZE_T
#include <stdlib.h>
size_t size = 32;
with your Sun C compiler and show us the diagnostic message
that it issues. ^^^^^^^
Why did you use the singular?
znsun1:~/tmp 9> uname -a
SunOS znsun1 5.6 Generic_105181-23 sun4u sparc
znsun1:~/tmp 10> which cc
/opt/SUNWspro/bin/cc
znsun1:~/tmp 11> cat test.c
#define _SIZE_T
#include <stdlib.h>
size_t size = 32;
znsun1:~/tmp 12> cc test.c
"/usr/include/stdlib.h", line 106: parameter redeclared: size_t
"/usr/include/stdlib.h", line 106: warning: function prototype parameters must have types
"/usr/include/stdlib.h", line 108: warning: function prototype parameters must have types
"/usr/include/stdlib.h", line 109: syntax error before or at: size_t
"/usr/include/stdlib.h", line 109: warning: undefined or missing type for: size_t
"/usr/include/stdlib.h", line 118: syntax error before or at: size_t
"/usr/include/stdlib.h", line 118: warning: undefined or missing type for: size_t
"/usr/include/stdlib.h", line 119: syntax error before or at: int
"/usr/include/stdlib.h", line 119: warning: undefined or missing type for: int
"/usr/include/stdlib.h", line 119: function cannot return function or array
"/usr/include/stdlib.h", line 119: syntax error before or at: )
"/usr/include/stdlib.h", line 119: warning: syntax error: empty declaration
"/usr/include/stdlib.h", line 120: syntax error before or at: size_t
"/usr/include/stdlib.h", line 120: warning: undefined or missing type for: size_t
"/usr/include/stdlib.h", line 121: syntax error before or at: int
"/usr/include/stdlib.h", line 121: warning: undefined or missing type for: int
"/usr/include/stdlib.h", line 121: function cannot return function or array
"/usr/include/stdlib.h", line 121: syntax error before or at: )
"/usr/include/stdlib.h", line 121: warning: syntax error: empty declaration
"/usr/include/stdlib.h", line 128: syntax error before or at: size_t
"/usr/include/stdlib.h", line 128: warning: undefined or missing type for: size_t
"/usr/include/stdlib.h", line 129: syntax error before or at: size_t
"/usr/include/stdlib.h", line 129: warning: undefined or missing type for: size_t
"/usr/include/stdlib.h", line 132: syntax error before or at: mbstowcs
"/usr/include/stdlib.h", line 132: syntax error before or at: size_t
"/usr/include/stdlib.h", line 132: warning: undefined or missing type for: size_t
"/usr/include/stdlib.h", line 132: warning: old-style declaration or incorrect type for: mbstowcs
"/usr/include/stdlib.h", line 133: syntax error before or at: wcstombs
"/usr/include/stdlib.h", line 133: syntax error before or at: size_t
"/usr/include/stdlib.h", line 133: warning: undefined or missing type for: size_t
"/usr/include/stdlib.h", line 133: warning: old-style declaration or incorrect type for: wcstombs
"/usr/include/stdlib.h", line 175: syntax error before or at: size_t
"/usr/include/stdlib.h", line 175: warning: undefined or missing type for: size_t
"/usr/include/stdlib.h", line 185: warning: function prototype parameters must have types
"/usr/include/stdlib.h", line 194: syntax error before or at: size_t
"/usr/include/stdlib.h", line 194: warning: undefined or missing type for: size_t
"/usr/include/stdlib.h", line 204: parameter redeclared: size_t
"/usr/include/stdlib.h", line 204: warning: function prototype parameters must have types
"test.c", line 4: warning: old-style declaration or incorrect type for: size_t
"test.c", line 4: syntax error before or at: size
"test.c", line 4: warning: old-style declaration or incorrect type for: size
cc: acomp failed for test.c
Which was to be expected: you told <stdlib.h> (and any headers it might
include) that size_t is *already* defined, which was a lie. You know what
it happens when you lie to your implementation, right?
Dan