On Sun, 1 Nov 1998 18:30:46 +0100, Frank Heckenbach wrote:
Harald A. Irmer wrote:
3.RAND_MAX (p/rts/random.c) is not known to SunOS, neither to gcc, set for my purpose #define RAND_MAX 32767
Hmmm... according to my rand() manpage, it's part of ISO, but anyway...
The problem here stems from the fact that SunOS does not normally come with an ANSI C compiler. (I ran into these problems several years ago back when I used a SunOS in college -- although not with gpc which I never tried as Sun's Pascal compiler isn't too bad.) On some systems there are compliant headers in /usr/5include but not in /usr/include. Basically the latter is for the "BSD environment" [icky.] and the former is for the "SysV environment" [the ANSI C we all love.] Unfortunately I never played around enough to figure out how to get SysV as the default :( The original poster put "BSD" in the header so if he wants that environment he should be prepared for the problem that this is going to cause trying to compile ANSI C code.
To be honest I thought gcc came with scripts to 'fix' the SunOS headers -- but I don't have a source tree handy to check the READMEs. A Sun FAQ I found on dejanews recommends running 'fixincludes' after installing GCC but that is with the precompiled binaries.
Or to say it differently: how do you know that 32767 is correct for SunOS? Does SunOS document it? (As a general fact or only for SunOS?) Or is it written in some header in some way?
Yes, it is hard to say what would be "correct" for the system. The C standard however does require a minimum of 32767, so setting it to that should be safe or you could even set it to INT_MAX I suppose (which -should- be defined in limits.h.)
-Kevin
-- Kevin A. Foss --- kfoss@mint.net