[comp.sources.bugs] Lacking <limits.h>

jhc@vax5.CIT.CORNELL.EDU (02/10/89)

It appears that the NeXTs are also lacking <limits.h>.  And that with gcc as
the standard compiler.

Anyone on c.s.N know why <limits.h> is not included (yet?)?  An oversight?
Not neccessary?  Anyone from NeXT care to comment?  (Or should I ask Mr.
Jobs in ~8 hrs? ;-)

[For the benefit of the c.s.n readers who are not following the discussion
on c.s.b, the pax program recently posted to comp.sources.unix failed to
make on someone's UNIX PC.  I had the same problem compiling it on a NeXT.
Neither computer had the file <limits.h>, which gets included if __STDC__ is
defined, as it should be in gcc.]

-JimC
--
James H. Cloos, Jr.          "Entropy isn't what it used to be."
jhc@Crnlvax5.BITNET            --c/o Fortune @ batcomputer.UUCP
jhc@Vax5.CIT.Cornell.EDU	 #include <std_disclaimers.h>
cornell!vax1!vax5.cit.cornell.edu!jhc@rochester.UUCP
B-7 Upson Hall, Cornell Univ., Ithaca, NY 14853   +1 607 272 4519

mark@jhereg.Jhereg.MN.ORG (Mark H. Colburn) (02/12/89)

In article <17934@vax5.CIT.CORNELL.EDU> jhc@vax5.cit.cornell.edu (James H. Cloos, Jr.) writes:
>It appears that the NeXTs are also lacking <limits.h>.  And that with gcc as
>the standard compiler.

I beleive it is not included because some of the values are somewhat
hardware dependant.  I have a limits.h which is the minimum required by
ANSI and POSIX, you may use it if you like...

/* $Source: /u/mark/src/ansi/RCS/limits.h,v $
 *
 * $Revision: 1.1 $
 *
 * limits.h - ANSI/POSIX compatible defnitions
 *
 * DESCRIPTION
 *
 * 	These values where taken from ANSI C (X3J11-10/88) and the IEEE 
 *	1003.1-88 standard.  All of the values below are the MINIMUM values 
 *	allowed by the standards. 
 *
 * AUTHOR
 *
 *     Mark H. Colburn, Minnetech Consulting, Inc. (mark@jhereg.mn.org)
 */

#ifndef __LIMITS_H
#define __LIMITS_H

/* Defines */

#define CHAR_BIT	8		/* number of bits in a "char" */
#define CHAR_MAX	UCHAR_MAX	/* max value for "char" */
/* #define CHAR_MAX	SCHAR_MAX 	/* */
#define CHAR_MIN	0		/* min value for "char" */
/* #define CHAR_MIN	SCHAR_MIN	/* */
#define INT_MAX		32767		/* max value for "int" */
#define INT_MIN		-32767		/* min value for "int" */
#define LONG_MAX	2147483647	/* max value for "long int" */
#define LONG_MIN	-2147483647	/* min value for "long int" */
#define MB_LEN_MAX	1		/* max bytes in a multibyte char */
#define SCHAR_MAX	127		/* max value for "signed char" */
#define SCHAR_MIN	-127		/* min value for "signed char" */
#define SHRT_MAX	32767		/* max value for "short int" */
#define SHRT_MIN	-32767		/* min value for "short int" */
#define UCHAR_MAX	255		/* max value for "unsigned char" */
#define UINT_MAX	65535		/* max value for "unsigned int" */
#define ULONG_MAX	4294967295	/* max value for "unsigned long" */
#define USHRT_MAX	65535		/* max value for "unsigned short" */

#ifdef _POSIX_SOURCE

#define MAX_INPUT	256	/* Max numbef of bytes in terminal input */
#define NGROUPS_MAX	1	/* Max number of suplemental group id's */
#define PASS_MAX	8	/* Max number of bytes in a password */
#define PID_MAX		30000	/* Max value for a process ID */
#define UID_MAX		32000	/* Max value for a user or group ID */
#define ARG_MAX		4096	/* Nax number of bytes passed to exec */
#define CHILD_MAX	6	/* Max number of simultaneous processes */
#define MAX_CANON	256	/* Max numbef of bytes in a cononical queue */
#define OPEN_MAX	16	/* Nax number of open files per process */
#define NAME_MAX	14	/* Max number of bytes in a file name */
#define PATH_MAX	255	/* Max number of bytes in pathname */
#define LINK_MAX	8	/* Max value of a file's link count */
#define PIPE_BUF	512	/* Max number of bytes for pipe reads */

#endif /* _POSIX_SOURCE */
#endif /* __LIMITS_H */
-- 
Mark H. Colburn                  "Look into a child's eye;
Minnetech Consulting, Inc.        there's no hate and there's no lie;
mark@jhereg.mn.org                there's no black and there's no white."

consult@osiris.UUCP (Unix Consultation Mailbox ) (02/15/89)

In article <542@jhereg.Jhereg.MN.ORG> mark@jhereg.MN.ORG (Mark H. Colburn) writes:
>In article <17934@vax5.CIT.CORNELL.EDU> jhc@vax5.cit.cornell.edu (James H. Cloos, Jr.) writes:
>>It appears that the NeXTs are also lacking <limits.h>.  And that with gcc as
>>the standard compiler.
>
>I beleive it is not included because some of the values are somewhat
>hardware dependant.

Well, yeah, <limits.h> is (more than somewhat) hardware dependent... which
is certainly no reason *not* to include it in the distribution, but in fact
the exact opposite - it's not the kind of file you *can* port from another
random system without problems, so it *should* be distributed.  Maybe what
Mark Colburn said was based on misinterpreting James Cloos' statement to
mean that *gcc* was not distributed with limits.h (reasonable), when in
fact James meant that the NeXT was not shipped with <limits.h> as part of
its standard software (NOT reasonable).

>I have a limits.h which is the minimum required by
>ANSI and POSIX, you may use it if you like...

I looked at this and while it looks pretty close, I'll bet it doesn't work
on a NeXT (the 16-bit int and default unsigned char make me suspicious) -
what kind of system was this limits.h tweaked for?


phil

mark@jhereg.Jhereg.MN.ORG (Mark H. Colburn) (02/15/89)

In article <2839@osiris.UUCP> consult@osiris.UUCP (Unix Consultation Mailbox (Phil)) writes:
+In article <542@jhereg.Jhereg.MN.ORG> mark@jhereg.MN.ORG (Mark H. Colburn) writes:
+>In article <17934@vax5.CIT.CORNELL.EDU> jhc@vax5.cit.cornell.edu (James H. Cloos, Jr.) writes:
+random system without problems, so it *should* be distributed.  Maybe what
+Mark Colburn said was based on misinterpreting James Cloos' statement to
+mean that *gcc* was not distributed with limits.h (reasonable), when in
+fact James meant that the NeXT was not shipped with <limits.h> as part of
+its standard software (NOT reasonable).

You're absolutely right.   I did misunderstand, and NeXT should supply a
version of limits.h. 

+
+>I have a limits.h which is the minimum required by
+>ANSI and POSIX, you may use it if you like...
+
+I looked at this and while it looks pretty close, I'll bet it doesn't work
+on a NeXT (the 16-bit int and default unsigned char make me suspicious) -
+what kind of system was this limits.h tweaked for?

It wasn't.  I simply pulled it out of ANSI and POSIX documentation.

-- 
Mark H. Colburn                  "Look into a child's eye;
Minnetech Consulting, Inc.        there's no hate and there's no lie;
mark@jhereg.mn.org                there's no black and there's no white."