limits.h for the Unix PC
My name is already in the article, you stupid postnews program
wilber at alice.UUCP
Sun Oct 2 13:13:54 AEST 1988
Here's an ANSI C compatible limits.h file for the Unix PC. Put it in
/usr/include. (And stop putting those "magic constants" in your code. :-)
Bob Wilber wilber at research.att.com
-------------- Cut Here ----------------------------------------------------
#ifndef LIMITS_DOT_H
#define LIMITS_DOT_H
/* ANSI C compatible limits.h file for the 3b1. If your C compiler doesn't
understand the U suffix for unsigned constants, define NOT_ANSI_C at
the front of this file (or before you include it).
*/
#define NOT_ANSI_C /* Stock 3b1 CC can't handle U. GCC should be able to. */
/* Bits in a char. */
#define CHAR_BIT 8
/* Maximum value of a char. (3b1 uses signed chars.) */
#define CHAR_MAX SCHAR_MAX
/* Minimum value of a char. */
#define CHAR_MIN SCHAR_MIN
/* Maximum value of an int. */
#define INT_MAX 2147483647
/* Minimum value of an int. */
#define INT_MIN (-2147483648)
/* Maximum value of a long. */
#define LONG_MAX 2147483647L
/* Minimum value of a long. */
#define LONG_MIN (-2147483648L)
/* Maximum value of a signed char. */
#define SCHAR_MAX 127
/* Minimum value of a signed char. */
#define SCHAR_MIN (-128)
/* Maximum value of a short. */
#define SHRT_MAX 32767
/* Minimum value of a short. */
#define SHRT_MIN (-32768)
#ifdef NOT_ANSI_C
/* Maximum value of an unsigned char. */
#define UCHAR_MAX ((unsigned int) 255)
/* Maximum value of an unsigned int. */
#define UINT_MAX ((unsigned int) 4294967295)
/* Maximum value of an unsigned long. */
#define ULONG_MAX ((unsigned long) 4294967295L)
/* Maximum value of an unsigned short. */
#define USHRT_MAX ((unsigned int) 65535)
#else
/* Maximum value of an unsigned char. */
#define UCHAR_MAX 255U
/* Maximum value of an unsigned int. */
#define UINT_MAX 4294967295U
/* Maximum value of an unsigned long. */
#define ULONG_MAX 4294967295UL
/* Maximum value of an unsigned short. */
#define USHRT_MAX 65535U
#endif
#endif /* LIMITS_DOT_H */
More information about the Unix-pc.sources
mailing list