<refentry id="glib-Limits-of-Basic-Types">
<refmeta>
<refentrytitle role="top_of_page" id="glib-Limits-of-Basic-Types.top_of_page">Limits of Basic Types</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GLIB Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Limits of Basic Types</refname>
<refpurpose>portable method of determining the limits of the standard types</refpurpose>
</refnamediv>

<refsynopsisdiv id="glib-Limits-of-Basic-Types.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;glib.h&gt;

#define             <link linkend="G-MININT--CAPS">G_MININT</link>
#define             <link linkend="G-MAXINT--CAPS">G_MAXINT</link>
#define             <link linkend="G-MAXUINT--CAPS">G_MAXUINT</link>

#define             <link linkend="G-MINSHORT--CAPS">G_MINSHORT</link>
#define             <link linkend="G-MAXSHORT--CAPS">G_MAXSHORT</link>
#define             <link linkend="G-MAXUSHORT--CAPS">G_MAXUSHORT</link>

#define             <link linkend="G-MINLONG--CAPS">G_MINLONG</link>
#define             <link linkend="G-MAXLONG--CAPS">G_MAXLONG</link>
#define             <link linkend="G-MAXULONG--CAPS">G_MAXULONG</link>

#define             <link linkend="G-MININT8--CAPS">G_MININT8</link>
#define             <link linkend="G-MAXINT8--CAPS">G_MAXINT8</link>
#define             <link linkend="G-MAXUINT8--CAPS">G_MAXUINT8</link>

#define             <link linkend="G-MININT16--CAPS">G_MININT16</link>
#define             <link linkend="G-MAXINT16--CAPS">G_MAXINT16</link>
#define             <link linkend="G-MAXUINT16--CAPS">G_MAXUINT16</link>

#define             <link linkend="G-MININT32--CAPS">G_MININT32</link>
#define             <link linkend="G-MAXINT32--CAPS">G_MAXINT32</link>
#define             <link linkend="G-MAXUINT32--CAPS">G_MAXUINT32</link>

#define             <link linkend="G-MININT64--CAPS">G_MININT64</link>
#define             <link linkend="G-MAXINT64--CAPS">G_MAXINT64</link>
#define             <link linkend="G-MAXUINT64--CAPS">G_MAXUINT64</link>

#define             <link linkend="G-MAXSIZE--CAPS">G_MAXSIZE</link>
#define             <link linkend="G-MINSSIZE--CAPS">G_MINSSIZE</link>
#define             <link linkend="G-MAXSSIZE--CAPS">G_MAXSSIZE</link>

#define             <link linkend="G-MINOFFSET--CAPS">G_MINOFFSET</link>
#define             <link linkend="G-MAXOFFSET--CAPS">G_MAXOFFSET</link>

#define             <link linkend="G-MINFLOAT--CAPS">G_MINFLOAT</link>
#define             <link linkend="G-MAXFLOAT--CAPS">G_MAXFLOAT</link>

#define             <link linkend="G-MINDOUBLE--CAPS">G_MINDOUBLE</link>
#define             <link linkend="G-MAXDOUBLE--CAPS">G_MAXDOUBLE</link>
</synopsis>
</refsynopsisdiv>









<refsect1 id="glib-Limits-of-Basic-Types.description" role="desc">
<title role="desc.title">Description</title>
<para>
These macros provide a portable method to determine the limits of some of
the standard integer and floating point types.
</para>
</refsect1>

<refsect1 id="glib-Limits-of-Basic-Types.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="G-MININT--CAPS" role="macro">
<title>G_MININT</title>
<indexterm zone="G-MININT--CAPS"><primary sortas="MININT">G_MININT</primary></indexterm><programlisting>#define G_MININT	INT_MIN
</programlisting>
<para>
The minimum value which can be held in a <link linkend="gint"><type>gint</type></link>.
</para></refsect2>
<refsect2 id="G-MAXINT--CAPS" role="macro">
<title>G_MAXINT</title>
<indexterm zone="G-MAXINT--CAPS"><primary sortas="MAXINT">G_MAXINT</primary></indexterm><programlisting>#define G_MAXINT	INT_MAX
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gint"><type>gint</type></link>.
</para></refsect2>
<refsect2 id="G-MAXUINT--CAPS" role="macro">
<title>G_MAXUINT</title>
<indexterm zone="G-MAXUINT--CAPS"><primary sortas="MAXUINT">G_MAXUINT</primary></indexterm><programlisting>#define G_MAXUINT	UINT_MAX
</programlisting>
<para>
The maximum value which can be held in a <link linkend="guint"><type>guint</type></link>.
</para></refsect2>
<refsect2 id="G-MINSHORT--CAPS" role="macro">
<title>G_MINSHORT</title>
<indexterm zone="G-MINSHORT--CAPS"><primary sortas="MINSHORT">G_MINSHORT</primary></indexterm><programlisting>#define G_MINSHORT	SHRT_MIN
</programlisting>
<para>
The minimum value which can be held in a <link linkend="gshort"><type>gshort</type></link>.
</para></refsect2>
<refsect2 id="G-MAXSHORT--CAPS" role="macro">
<title>G_MAXSHORT</title>
<indexterm zone="G-MAXSHORT--CAPS"><primary sortas="MAXSHORT">G_MAXSHORT</primary></indexterm><programlisting>#define G_MAXSHORT	SHRT_MAX
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gshort"><type>gshort</type></link>.
</para></refsect2>
<refsect2 id="G-MAXUSHORT--CAPS" role="macro">
<title>G_MAXUSHORT</title>
<indexterm zone="G-MAXUSHORT--CAPS"><primary sortas="MAXUSHORT">G_MAXUSHORT</primary></indexterm><programlisting>#define G_MAXUSHORT	USHRT_MAX
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gushort"><type>gushort</type></link>.
</para></refsect2>
<refsect2 id="G-MINLONG--CAPS" role="macro">
<title>G_MINLONG</title>
<indexterm zone="G-MINLONG--CAPS"><primary sortas="MINLONG">G_MINLONG</primary></indexterm><programlisting>#define G_MINLONG	LONG_MIN
</programlisting>
<para>
The minimum value which can be held in a <link linkend="glong"><type>glong</type></link>.
</para></refsect2>
<refsect2 id="G-MAXLONG--CAPS" role="macro">
<title>G_MAXLONG</title>
<indexterm zone="G-MAXLONG--CAPS"><primary sortas="MAXLONG">G_MAXLONG</primary></indexterm><programlisting>#define G_MAXLONG	LONG_MAX
</programlisting>
<para>
The maximum value which can be held in a <link linkend="glong"><type>glong</type></link>.
</para></refsect2>
<refsect2 id="G-MAXULONG--CAPS" role="macro">
<title>G_MAXULONG</title>
<indexterm zone="G-MAXULONG--CAPS"><primary sortas="MAXULONG">G_MAXULONG</primary></indexterm><programlisting>#define G_MAXULONG	ULONG_MAX
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gulong"><type>gulong</type></link>.
</para></refsect2>
<refsect2 id="G-MININT8--CAPS" role="macro" condition="since:2.4">
<title>G_MININT8</title>
<indexterm zone="G-MININT8--CAPS" role="2.4"><primary sortas="MININT8">G_MININT8</primary></indexterm><programlisting>#define G_MININT8	((gint8)  0x80)
</programlisting>
<para>
The minimum value which can be held in a <link linkend="gint8"><type>gint8</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MAXINT8--CAPS" role="macro" condition="since:2.4">
<title>G_MAXINT8</title>
<indexterm zone="G-MAXINT8--CAPS" role="2.4"><primary sortas="MAXINT8">G_MAXINT8</primary></indexterm><programlisting>#define G_MAXINT8	((gint8)  0x7f)
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gint8"><type>gint8</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MAXUINT8--CAPS" role="macro" condition="since:2.4">
<title>G_MAXUINT8</title>
<indexterm zone="G-MAXUINT8--CAPS" role="2.4"><primary sortas="MAXUINT8">G_MAXUINT8</primary></indexterm><programlisting>#define G_MAXUINT8	((guint8) 0xff)
</programlisting>
<para>
The maximum value which can be held in a <link linkend="guint8"><type>guint8</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MININT16--CAPS" role="macro" condition="since:2.4">
<title>G_MININT16</title>
<indexterm zone="G-MININT16--CAPS" role="2.4"><primary sortas="MININT16">G_MININT16</primary></indexterm><programlisting>#define G_MININT16	((gint16)  0x8000)
</programlisting>
<para>
The minimum value which can be held in a <link linkend="gint16"><type>gint16</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MAXINT16--CAPS" role="macro" condition="since:2.4">
<title>G_MAXINT16</title>
<indexterm zone="G-MAXINT16--CAPS" role="2.4"><primary sortas="MAXINT16">G_MAXINT16</primary></indexterm><programlisting>#define G_MAXINT16	((gint16)  0x7fff)
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gint16"><type>gint16</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MAXUINT16--CAPS" role="macro" condition="since:2.4">
<title>G_MAXUINT16</title>
<indexterm zone="G-MAXUINT16--CAPS" role="2.4"><primary sortas="MAXUINT16">G_MAXUINT16</primary></indexterm><programlisting>#define G_MAXUINT16	((guint16) 0xffff)
</programlisting>
<para>
The maximum value which can be held in a <link linkend="guint16"><type>guint16</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MININT32--CAPS" role="macro" condition="since:2.4">
<title>G_MININT32</title>
<indexterm zone="G-MININT32--CAPS" role="2.4"><primary sortas="MININT32">G_MININT32</primary></indexterm><programlisting>#define G_MININT32	((gint32)  0x80000000)
</programlisting>
<para>
The minimum value which can be held in a <link linkend="gint32"><type>gint32</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MAXINT32--CAPS" role="macro" condition="since:2.4">
<title>G_MAXINT32</title>
<indexterm zone="G-MAXINT32--CAPS" role="2.4"><primary sortas="MAXINT32">G_MAXINT32</primary></indexterm><programlisting>#define G_MAXINT32	((gint32)  0x7fffffff)
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gint32"><type>gint32</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MAXUINT32--CAPS" role="macro" condition="since:2.4">
<title>G_MAXUINT32</title>
<indexterm zone="G-MAXUINT32--CAPS" role="2.4"><primary sortas="MAXUINT32">G_MAXUINT32</primary></indexterm><programlisting>#define G_MAXUINT32	((guint32) 0xffffffff)
</programlisting>
<para>
The maximum value which can be held in a <link linkend="guint32"><type>guint32</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MININT64--CAPS" role="macro">
<title>G_MININT64</title>
<indexterm zone="G-MININT64--CAPS"><primary sortas="MININT64">G_MININT64</primary></indexterm><programlisting>#define G_MININT64	((gint64) G_GINT64_CONSTANT(0x8000000000000000))
</programlisting>
<para>
The minimum value which can be held in a <link linkend="gint64"><type>gint64</type></link>.
</para></refsect2>
<refsect2 id="G-MAXINT64--CAPS" role="macro">
<title>G_MAXINT64</title>
<indexterm zone="G-MAXINT64--CAPS"><primary sortas="MAXINT64">G_MAXINT64</primary></indexterm><programlisting>#define G_MAXINT64	G_GINT64_CONSTANT(0x7fffffffffffffff)
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gint64"><type>gint64</type></link>.
</para></refsect2>
<refsect2 id="G-MAXUINT64--CAPS" role="macro">
<title>G_MAXUINT64</title>
<indexterm zone="G-MAXUINT64--CAPS"><primary sortas="MAXUINT64">G_MAXUINT64</primary></indexterm><programlisting>#define G_MAXUINT64	G_GINT64_CONSTANT(0xffffffffffffffffU)
</programlisting>
<para>
The maximum value which can be held in a <link linkend="guint64"><type>guint64</type></link>.
</para></refsect2>
<refsect2 id="G-MAXSIZE--CAPS" role="macro" condition="since:2.4">
<title>G_MAXSIZE</title>
<indexterm zone="G-MAXSIZE--CAPS" role="2.4"><primary sortas="MAXSIZE">G_MAXSIZE</primary></indexterm><programlisting>#define G_MAXSIZE	G_MAXULONG
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gsize"><type>gsize</type></link>.
</para><para role="since">Since 2.4</para></refsect2>
<refsect2 id="G-MINSSIZE--CAPS" role="macro" condition="since:2.14">
<title>G_MINSSIZE</title>
<indexterm zone="G-MINSSIZE--CAPS" role="2.14"><primary sortas="MINSSIZE">G_MINSSIZE</primary></indexterm><programlisting>#define G_MINSSIZE	G_MINLONG
</programlisting>
<para>
The minimum value which can be held in a <link linkend="gssize"><type>gssize</type></link>.
</para><para role="since">Since 2.14</para></refsect2>
<refsect2 id="G-MAXSSIZE--CAPS" role="macro" condition="since:2.14">
<title>G_MAXSSIZE</title>
<indexterm zone="G-MAXSSIZE--CAPS" role="2.14"><primary sortas="MAXSSIZE">G_MAXSSIZE</primary></indexterm><programlisting>#define G_MAXSSIZE	G_MAXLONG
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gssize"><type>gssize</type></link>.
</para><para role="since">Since 2.14</para></refsect2>
<refsect2 id="G-MINOFFSET--CAPS" role="macro">
<title>G_MINOFFSET</title>
<indexterm zone="G-MINOFFSET--CAPS"><primary sortas="MINOFFSET">G_MINOFFSET</primary></indexterm><programlisting>#define G_MINOFFSET	G_MININT64
</programlisting>
<para>
The minimum value which can be held in a <link linkend="goffset"><type>goffset</type></link>.
</para></refsect2>
<refsect2 id="G-MAXOFFSET--CAPS" role="macro">
<title>G_MAXOFFSET</title>
<indexterm zone="G-MAXOFFSET--CAPS"><primary sortas="MAXOFFSET">G_MAXOFFSET</primary></indexterm><programlisting>#define G_MAXOFFSET	G_MAXINT64
</programlisting>
<para>
The maximum value which can be held in a <link linkend="goffset"><type>goffset</type></link>.
</para></refsect2>
<refsect2 id="G-MINFLOAT--CAPS" role="macro">
<title>G_MINFLOAT</title>
<indexterm zone="G-MINFLOAT--CAPS"><primary sortas="MINFLOAT">G_MINFLOAT</primary></indexterm><programlisting>#define G_MINFLOAT	FLT_MIN
</programlisting>
<para>
The minimum positive value which can be held in a <link linkend="gfloat"><type>gfloat</type></link>.
</para>
<para>
If you are interested in the smallest value which can be held in a <link linkend="gfloat"><type>gfloat</type></link>,
use -G_MAX_FLOAT.
</para></refsect2>
<refsect2 id="G-MAXFLOAT--CAPS" role="macro">
<title>G_MAXFLOAT</title>
<indexterm zone="G-MAXFLOAT--CAPS"><primary sortas="MAXFLOAT">G_MAXFLOAT</primary></indexterm><programlisting>#define G_MAXFLOAT	FLT_MAX
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gfloat"><type>gfloat</type></link>.
</para></refsect2>
<refsect2 id="G-MINDOUBLE--CAPS" role="macro">
<title>G_MINDOUBLE</title>
<indexterm zone="G-MINDOUBLE--CAPS"><primary sortas="MINDOUBLE">G_MINDOUBLE</primary></indexterm><programlisting>#define G_MINDOUBLE	DBL_MIN
</programlisting>
<para>
The minimum positive value which can be held in a <link linkend="gdouble"><type>gdouble</type></link>.
</para>
<para>
If you are interested in the smallest value which can be held in a <link linkend="gdouble"><type>gdouble</type></link>,
use -G_MAXDOUBLE.
</para></refsect2>
<refsect2 id="G-MAXDOUBLE--CAPS" role="macro">
<title>G_MAXDOUBLE</title>
<indexterm zone="G-MAXDOUBLE--CAPS"><primary sortas="MAXDOUBLE">G_MAXDOUBLE</primary></indexterm><programlisting>#define G_MAXDOUBLE	DBL_MAX
</programlisting>
<para>
The maximum value which can be held in a <link linkend="gdouble"><type>gdouble</type></link>.
</para></refsect2>

</refsect1>




</refentry>
