xref: /dflybsd-src/share/man/man7/stdint.7 (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino.\" Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
286d7f5d3SJohn Marino.\" All rights reserved.
386d7f5d3SJohn Marino.\"
486d7f5d3SJohn Marino.\" Redistribution and use in source and binary forms, with or without
586d7f5d3SJohn Marino.\" modification, are permitted provided that the following conditions
686d7f5d3SJohn Marino.\" are met:
786d7f5d3SJohn Marino.\" 1. Redistributions of source code must retain the above copyright
886d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer.
986d7f5d3SJohn Marino.\" 2. Redistributions in binary form must reproduce the above copyright
1086d7f5d3SJohn Marino.\"    notice, this list of conditions and the following disclaimer in the
1186d7f5d3SJohn Marino.\"    documentation and/or other materials provided with the distribution.
1286d7f5d3SJohn Marino.\"
1386d7f5d3SJohn Marino.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1486d7f5d3SJohn Marino.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1586d7f5d3SJohn Marino.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1686d7f5d3SJohn Marino.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1786d7f5d3SJohn Marino.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1886d7f5d3SJohn Marino.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1986d7f5d3SJohn Marino.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2086d7f5d3SJohn Marino.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2186d7f5d3SJohn Marino.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2286d7f5d3SJohn Marino.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2386d7f5d3SJohn Marino.\" SUCH DAMAGE.
2486d7f5d3SJohn Marino.\"
2586d7f5d3SJohn Marino.\" $FreeBSD: src/share/man/man7/stdint.7,v 1.5 2003/09/08 19:57:21 ru Exp $
2686d7f5d3SJohn Marino.\"
2786d7f5d3SJohn Marino.Dd March 22, 2009
2886d7f5d3SJohn Marino.Dt STDINT 7
2986d7f5d3SJohn Marino.Os
3086d7f5d3SJohn Marino.Sh NAME
3186d7f5d3SJohn Marino.Nm stdint
3286d7f5d3SJohn Marino.Nd "standard integer types"
3386d7f5d3SJohn Marino.Sh SYNOPSIS
3486d7f5d3SJohn Marino.In stdint.h
3586d7f5d3SJohn Marino.Sh DESCRIPTION
3686d7f5d3SJohn MarinoThe
3786d7f5d3SJohn Marino.In stdint.h
3886d7f5d3SJohn Marinoheader provides source-portable integer types of a specific
3986d7f5d3SJohn Marinosize, smallest memory footprint with a minimum size, fastest
4086d7f5d3SJohn Marinoaccess speed with a minimum size, largest integer size, and
4186d7f5d3SJohn Marinothose capable of storing pointers.
4286d7f5d3SJohn Marino.Pp
4386d7f5d3SJohn MarinoThe types
4486d7f5d3SJohn Marino.Vt int8_t ,
4586d7f5d3SJohn Marino.Vt int16_t ,
4686d7f5d3SJohn Marino.Vt int32_t ,
4786d7f5d3SJohn Marinoand
4886d7f5d3SJohn Marino.Vt int64_t
4986d7f5d3SJohn Marinoprovide a signed integer type of width 8, 16, 32, or 64 bits, respectively.
5086d7f5d3SJohn MarinoThe types
5186d7f5d3SJohn Marino.Vt uint8_t ,
5286d7f5d3SJohn Marino.Vt uint16_t ,
5386d7f5d3SJohn Marino.Vt uint32_t ,
5486d7f5d3SJohn Marinoand
5586d7f5d3SJohn Marino.Vt uint64_t
5686d7f5d3SJohn Marinoprovide an unsigned integer type of width 8, 16, 32, or 64 bits, respectively.
5786d7f5d3SJohn MarinoThese integer types should be used when a specific size is required.
5886d7f5d3SJohn Marino.Pp
5986d7f5d3SJohn MarinoThe types
6086d7f5d3SJohn Marino.Vt int_fast8_t ,
6186d7f5d3SJohn Marino.Vt int_fast16_t ,
6286d7f5d3SJohn Marino.Vt int_fast32_t ,
6386d7f5d3SJohn Marinoand
6486d7f5d3SJohn Marino.Vt int_fast64_t
6586d7f5d3SJohn Marinoprovide the fastest signed integer type with a width
6686d7f5d3SJohn Marinoof at least 8, 16, 32, or 64 bits, respectively.
6786d7f5d3SJohn MarinoThe types
6886d7f5d3SJohn Marino.Vt uint_fast8_t ,
6986d7f5d3SJohn Marino.Vt uint_fast16_t ,
7086d7f5d3SJohn Marino.Vt uint_fast32_t ,
7186d7f5d3SJohn Marinoand
7286d7f5d3SJohn Marino.Vt uint_fast64_t
7386d7f5d3SJohn Marinoprovide the fastest unsigned integer type with a width
7486d7f5d3SJohn Marinoof at least 8, 16, 32, or 64 bits, respectively.
7586d7f5d3SJohn MarinoThese types should be used when access speed is
7686d7f5d3SJohn Marinoparamount, and when a specific size is not required.
7786d7f5d3SJohn Marino.Pp
7886d7f5d3SJohn MarinoThe types
7986d7f5d3SJohn Marino.Vt int_least8_t ,
8086d7f5d3SJohn Marino.Vt int_least16_t ,
8186d7f5d3SJohn Marino.Vt int_least32_t ,
8286d7f5d3SJohn Marinoand
8386d7f5d3SJohn Marino.Vt int_least64_t
8486d7f5d3SJohn Marinoprovide the smallest memory footprint signed integer type with
8586d7f5d3SJohn Marinoa width of at least 8, 16, 32, or 64 bits, respectively.
8686d7f5d3SJohn MarinoThe types
8786d7f5d3SJohn Marino.Vt uint_least8_t ,
8886d7f5d3SJohn Marino.Vt uint_least16_t ,
8986d7f5d3SJohn Marino.Vt uint_least32_t ,
9086d7f5d3SJohn Marinoand
9186d7f5d3SJohn Marino.Vt uint_least64_t
9286d7f5d3SJohn Marinoprovide the smallest memory footprint unsigned integer type with
9386d7f5d3SJohn Marinoa width of at least 8, 16, 32, or 64 bits, respectively.
9486d7f5d3SJohn MarinoThese types should be used when memory storage is of
9586d7f5d3SJohn Marinoconcern, and when a specific size is not required.
9686d7f5d3SJohn Marino.Pp
9786d7f5d3SJohn MarinoThe type
9886d7f5d3SJohn Marino.Vt intmax_t
9986d7f5d3SJohn Marinoprovides a signed integer type large
10086d7f5d3SJohn Marinoenough to hold any other signed integer.
10186d7f5d3SJohn MarinoThe type
10286d7f5d3SJohn Marino.Vt uintmax_t
10386d7f5d3SJohn Marinoprovides an unsigned integer type large
10486d7f5d3SJohn Marinoenough to hold any other unsigned integer.
10586d7f5d3SJohn MarinoThese types are generally the largest signed and unsigned
10686d7f5d3SJohn Marinointeger types available on a specific architecture.
10786d7f5d3SJohn Marino.Pp
10886d7f5d3SJohn MarinoThe type
10986d7f5d3SJohn Marino.Vt intptr_t
11086d7f5d3SJohn Marinoprovides a signed integer type with the ability to hold a pointer to
11186d7f5d3SJohn Marino.Vt void ,
11286d7f5d3SJohn Marinothat can later be converted back to a pointer to
11386d7f5d3SJohn Marino.Vt void .
11486d7f5d3SJohn Marinoand the result will compare equal to the original pointer.
11586d7f5d3SJohn Marino.Pp
11686d7f5d3SJohn MarinoThe type
11786d7f5d3SJohn Marino.Vt uintptr_t
11886d7f5d3SJohn Marinoprovides an unsigned integer type with the ability to hold a pointer to
11986d7f5d3SJohn Marino.Vt void ,
12086d7f5d3SJohn Marinothat can later be converted back to a pointer to
12186d7f5d3SJohn Marino.Vt void .
12286d7f5d3SJohn Marinoand the result will compare equal to the original pointer.
12386d7f5d3SJohn Marino.Pp
12486d7f5d3SJohn MarinoThe
12586d7f5d3SJohn Marino.Fn INTX_C
12686d7f5d3SJohn Marinoexpands to an integer constant expression corresponding to the type
12786d7f5d3SJohn Marino.Vt int_leastX_t .
12886d7f5d3SJohn MarinoThe
12986d7f5d3SJohn Marino.Fn UINTX_C
13086d7f5d3SJohn Marinoexpands to an integer constant expression corresponding to the type
13186d7f5d3SJohn Marino.Vt uint_leastX_t .
13286d7f5d3SJohn MarinoFor example,
13386d7f5d3SJohn Marino.Fn UINT64_C 0x123
13486d7f5d3SJohn Marinoexpands to integer constant
13586d7f5d3SJohn Marino.Li 0x123ULL .
13686d7f5d3SJohn Marino.Pp
13786d7f5d3SJohn MarinoThe
13886d7f5d3SJohn Marino.Fn INTMAX_C
13986d7f5d3SJohn Marinomacro expands to an integer constant expression having the value specified
14086d7f5d3SJohn Marinoby its argument and the type
14186d7f5d3SJohn Marino.Vt intmax_t .
14286d7f5d3SJohn MarinoThe
14386d7f5d3SJohn Marino.Fn UINTMAX_C
14486d7f5d3SJohn Marinomacro expands to an integer constant expression having the value specified
14586d7f5d3SJohn Marinoby its argument and the type
14686d7f5d3SJohn Marino.Vt uintmax_t .
14786d7f5d3SJohn Marino.Sh STANDARDS
14886d7f5d3SJohn MarinoThe
14986d7f5d3SJohn Marino.In stdint.h
15086d7f5d3SJohn Marinoheader conforms to
15186d7f5d3SJohn Marino.St -isoC-99
15286d7f5d3SJohn Marinoand
15386d7f5d3SJohn Marino.St -p1003.1-2001 .
154