211 lines
6.8 KiB
HTML
211 lines
6.8 KiB
HTML
<HTML><HEAD><TITLE><limits.h></TITLE></HEAD><BODY BGCOLOR="#FFFFFF">
|
|
|
|
<H1><A NAME="<limits.h>"><CODE><limits.h></CODE></A></H1><HR>
|
|
|
|
<P><CODE>
|
|
#define <A HREF="#CHAR_BIT"><B>CHAR_BIT</B></A>
|
|
<I><#if expression >= 8></I><BR>
|
|
#define <A HREF="#CHAR_MAX"><B>CHAR_MAX</B></A>
|
|
<I><#if expression >= 127></I><BR>
|
|
#define <A HREF="#CHAR_MIN"><B>CHAR_MIN</B></A>
|
|
<I><#if expression <= 0></I><BR>
|
|
#define <A HREF="#INT_MAX"><B>INT_MAX</B></A>
|
|
<I><#if expression >= 32,767></I><BR>
|
|
#define <A HREF="#INT_MIN"><B>INT_MIN</B></A>
|
|
<I><#if expression <= -32,767></I><BR>
|
|
#define <A HREF="#LONG_MAX"><B>LONG_MAX</B></A>
|
|
<I><#if expression >= 2,147,483,647></I><BR>
|
|
#define <A HREF="#LONG_MIN"><B>LONG_MIN</B></A>
|
|
<I><#if expression <= -2,147,483,647></I><BR>
|
|
#define <A HREF="#MB_LEN_MAX"><B>MB_LEN_MAX</B></A>
|
|
<I><#if expression >= 1></I><BR>
|
|
#define <A HREF="#SCHAR_MAX"><B>SCHAR_MAX</B></A>
|
|
<I><#if expression >= 127></I><BR>
|
|
#define <A HREF="#SCHAR_MIN"><B>SCHAR_MIN</B></A>
|
|
<I><#if expression <= -127></I><BR>
|
|
#define <A HREF="#SHRT_MAX"><B>SHRT_MAX</B></A>
|
|
<I><#if expression >= 32,767></I><BR>
|
|
#define <A HREF="#SHRT_MIN"><B>SHRT_MIN</B></A>
|
|
<I><#if expression <= -32,767></I><BR>
|
|
#define <A HREF="#UCHAR_MAX"><B>UCHAR_MAX</B></A>
|
|
<I><#if expression >= 255></I><BR>
|
|
#define <A HREF="#UINT_MAX"><B>UINT_MAX</B></A>
|
|
<I><#if expression >= 65,535></I><BR>
|
|
#define <A HREF="#ULONG_MAX"><B>ULONG_MAX</B></A>
|
|
<I><#if expression >= 4,294,967,295></I><BR>
|
|
#define <A HREF="#USHRT_MAX"><B>USHRT_MAX</B></A>
|
|
<I><#if expression >= 65,535></I>
|
|
</CODE></P>
|
|
|
|
<P>Include the standard header <B><CODE><limits.h></CODE></B>
|
|
to determine various properties of the integer type representations.
|
|
The standard header <CODE><limits.h></CODE> is available
|
|
even in a
|
|
<A HREF="lib_over.html#freestanding implementation" tppabs="http://ccs.ucsd.edu/c/lib_over.html#freestanding implementation">
|
|
freestanding implementation</A>.</P>
|
|
|
|
<P>You can test the values of all these macros in an
|
|
<A HREF="preproc.html#if directive" tppabs="http://ccs.ucsd.edu/c/preproc.html#if directive"><I>if</I> directive</A>.
|
|
(The macros are
|
|
<A HREF="preproc.html#if expression" tppabs="http://ccs.ucsd.edu/c/preproc.html#if expression"><I>#if</I> expressions</A>.)</P>
|
|
|
|
<H2><A NAME="CHAR_BIT"><CODE>CHAR_BIT</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>CHAR_BIT</B> <I><#if expression >= 8></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for the number of bits used
|
|
to represent an object of type <I>char.</I></P>
|
|
|
|
<H2><A NAME="CHAR_MAX"><CODE>CHAR_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>CHAR_MAX</B> <I><#if expression >= 127></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for type <I>char.</I> Its
|
|
value is:</P>
|
|
|
|
<UL>
|
|
<LI><A HREF="#SCHAR_MAX"><CODE>SCHAR_MAX</CODE></A>
|
|
if <I>char</I> represents negative values
|
|
|
|
<LI><A HREF="#UCHAR_MAX"><CODE>UCHAR_MAX</CODE></A> otherwise
|
|
</UL>
|
|
|
|
<H2><A NAME="CHAR_MIN"><CODE>CHAR_MIN</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>CHAR_MIN</B> <I><#if expression <= 0></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the minimum value for type <I>char.</I> Its
|
|
value is:</P>
|
|
|
|
<UL>
|
|
<LI><A HREF="#SCHAR_MIN"><CODE>SCHAR_MIN</CODE></A>
|
|
if <I>char</I> represents negative values
|
|
|
|
<LI>zero otherwise
|
|
</UL>
|
|
|
|
<H2><A NAME="INT_MAX"><CODE>INT_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>INT_MAX</B> <I><#if expression >= 32,767></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for type <I>int.</I></P>
|
|
|
|
<H2><A NAME="INT_MIN"><CODE>INT_MIN</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>INT_MIN</B> <I><#if expression <= -32,767></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the minimum value for type <I>int.</I></P>
|
|
|
|
<H2><A NAME="LONG_MAX"><CODE>LONG_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>LONG_MAX</B> <I><#if expression >= 2,147,483,647></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for type <I>long.</I></P>
|
|
|
|
<H2><A NAME="LONG_MIN"><CODE>LONG_MIN</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>LONG_MIN</B> <I><#if expression <= -2,147,483,647></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the minimum value for type <I>long.</I></P>
|
|
|
|
<H2><A NAME="MB_LEN_MAX"><CODE>MB_LEN_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>MB_LEN_MAX</B> <I><#if expression >= 1></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum number of characters that constitute a
|
|
<A HREF="charset.html#Multibyte Characters" tppabs="http://ccs.ucsd.edu/c/charset.html#Multibyte Characters">multibyte character</A>
|
|
in any supported
|
|
<A HREF="locale.html" tppabs="http://ccs.ucsd.edu/c/locale.html">locale</A>. Its value is >=
|
|
<A HREF="stdlib.html#MB_CUR_MAX" tppabs="http://ccs.ucsd.edu/c/stdlib.html#MB_CUR_MAX"><CODE>MB_CUR_MAX</CODE></A>.</P>
|
|
|
|
<H2><A NAME="SCHAR_MAX"><CODE>SCHAR_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>SCHAR_MAX</B> <I><#if expression >= 127></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for type <I>signed char.</I></P>
|
|
|
|
<H2><A NAME="SCHAR_MIN"><CODE>SCHAR_MIN</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>SCHAR_MIN</B> <I><#if expression <= -127></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the minimum value for type <I>signed char.</I></P>
|
|
|
|
<H2><A NAME="SHRT_MAX"><CODE>SHRT_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>SHRT_MAX</B> <I><#if expression >= 32,767></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for type <I>short.</I></P>
|
|
|
|
<H2><A NAME="SHRT_MIN"><CODE>SHRT_MIN</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>SHRT_MIN</B> <I><#if expression <= -32,767></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the minimum value for type <I>short.</I></P>
|
|
|
|
<H2><A NAME="UCHAR_MAX"><CODE>UCHAR_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>UCHAR_MAX</B> <I><#if expression >= 255></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for type <I>unsigned char.</I></P>
|
|
|
|
<H2><A NAME="UINT_MAX"><CODE>UINT_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>UINT_MAX</B> <I><#if expression >= 65,535></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for type <I>unsigned int.</I></P>
|
|
|
|
<H2><A NAME="ULONG_MAX"><CODE>ULONG_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>ULONG_MAX</B> <I><#if expression >= 4,294,967,295></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for type <I>unsigned long.</I></P>
|
|
|
|
<H2><A NAME="USHRT_MAX"><CODE>USHRT_MAX</CODE></A></H2>
|
|
|
|
<P><CODE>
|
|
#define <B>USHRT_MAX</B> <I><#if expression >= 65,535></I>
|
|
</CODE></P>
|
|
|
|
<P>The macro yields the maximum value for type <I>unsigned short.</P>
|
|
|
|
<HR>
|
|
<P>See also the
|
|
<B><A HREF="index.html#Table of Contents" tppabs="http://ccs.ucsd.edu/c/index.html#Table of Contents">Table of Contents</A></B> and the
|
|
<B><A HREF="_index.html" tppabs="http://ccs.ucsd.edu/c/_index.html">Index</A></B>.</P>
|
|
|
|
<P><I>
|
|
<A HREF="crit_pb.html" tppabs="http://ccs.ucsd.edu/c/crit_pb.html">Copyright</A> © 1989-1996
|
|
by P.J. Plauger and Jim Brodie. All rights reserved.</I></P>
|
|
|
|
</BODY></HTML>
|