1*ea330d8dSjruoho.\" $NetBSD: stdint.3,v 1.6 2011/08/09 18:11:37 jruoho Exp $ 2a48c6c7aSjruoho.\" 3a48c6c7aSjruoho.\" Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> 4a48c6c7aSjruoho.\" All rights reserved. 5a48c6c7aSjruoho.\" 6a48c6c7aSjruoho.\" Redistribution and use in source and binary forms, with or without 7a48c6c7aSjruoho.\" modification, are permitted provided that the following conditions 8a48c6c7aSjruoho.\" are met: 9a48c6c7aSjruoho.\" 1. Redistributions of source code must retain the above copyright 10a48c6c7aSjruoho.\" notice, this list of conditions and the following disclaimer. 11a48c6c7aSjruoho.\" 2. Redistributions in binary form must reproduce the above copyright 12a48c6c7aSjruoho.\" notice, this list of conditions and the following disclaimer in the 13a48c6c7aSjruoho.\" documentation and/or other materials provided with the distribution. 14a48c6c7aSjruoho.\" 15a48c6c7aSjruoho.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16a48c6c7aSjruoho.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17a48c6c7aSjruoho.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18a48c6c7aSjruoho.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19a48c6c7aSjruoho.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20a48c6c7aSjruoho.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21a48c6c7aSjruoho.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22a48c6c7aSjruoho.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23a48c6c7aSjruoho.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24a48c6c7aSjruoho.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25a48c6c7aSjruoho.\" SUCH DAMAGE. 26a48c6c7aSjruoho.\" 27a48c6c7aSjruoho.\" $FreeBSD: src/share/man/man7/stdint.7,v 1.5 2003/09/08 19:57:21 ru Exp $ 28a48c6c7aSjruoho.\" 29*ea330d8dSjruoho.Dd August 9, 2011 30a48c6c7aSjruoho.Dt STDINT 3 31a48c6c7aSjruoho.Os 32a48c6c7aSjruoho.Sh NAME 33a48c6c7aSjruoho.Nm stdint 3494e9a9e2Swiz.Nd standard integer types 35a48c6c7aSjruoho.Sh SYNOPSIS 36a48c6c7aSjruoho.In stdint.h 37a48c6c7aSjruoho.Sh DESCRIPTION 38a48c6c7aSjruohoThe 39a48c6c7aSjruoho.In stdint.h 40a48c6c7aSjruohoheader provides source-portable integer types of a specific 41a48c6c7aSjruohosize, smallest memory footprint with a minimum size, fastest 42a48c6c7aSjruohoaccess speed with a minimum size, largest integer size, and 43a48c6c7aSjruohothose capable of storing pointers. 44a48c6c7aSjruoho.Pp 45a48c6c7aSjruohoThe types 46a48c6c7aSjruoho.Vt int8_t , 47a48c6c7aSjruoho.Vt int16_t , 48a48c6c7aSjruoho.Vt int32_t , 49a48c6c7aSjruohoand 50a48c6c7aSjruoho.Vt int64_t 51a48c6c7aSjruohoprovide a signed integer type of width 8, 16, 32, or 64 bits, respectively. 52a48c6c7aSjruohoThe types 53a48c6c7aSjruoho.Vt uint8_t , 54a48c6c7aSjruoho.Vt uint16_t , 55a48c6c7aSjruoho.Vt uint32_t , 56a48c6c7aSjruohoand 57a48c6c7aSjruoho.Vt uint64_t 58a48c6c7aSjruohoprovide an unsigned integer type of width 8, 16, 32, or 64 bits, respectively. 59a48c6c7aSjruohoThese integer types should be used when a specific size is required. 60a48c6c7aSjruoho.Pp 61a48c6c7aSjruohoThe types 62a48c6c7aSjruoho.Vt int_fast8_t , 63a48c6c7aSjruoho.Vt int_fast16_t , 64a48c6c7aSjruoho.Vt int_fast32_t , 65a48c6c7aSjruohoand 66a48c6c7aSjruoho.Vt int_fast64_t 67a48c6c7aSjruohoprovide the fastest signed integer type with a width 68a48c6c7aSjruohoof at least 8, 16, 32, or 64 bits, respectively. 69a48c6c7aSjruohoThe types 70a48c6c7aSjruoho.Vt uint_fast8_t , 71a48c6c7aSjruoho.Vt uint_fast16_t , 72a48c6c7aSjruoho.Vt uint_fast32_t , 73a48c6c7aSjruohoand 74a48c6c7aSjruoho.Vt uint_fast64_t 75a48c6c7aSjruohoprovide the fastest unsigned integer type with a width 76a48c6c7aSjruohoof at least 8, 16, 32, or 64 bits, respectively. 77a48c6c7aSjruohoThese types should be used when access speed is 78a48c6c7aSjruohoparamount, and when a specific size is not required. 79a48c6c7aSjruoho.Pp 80a48c6c7aSjruohoThe types 81a48c6c7aSjruoho.Vt int_least8_t , 82a48c6c7aSjruoho.Vt int_least16_t , 83a48c6c7aSjruoho.Vt int_least32_t , 84a48c6c7aSjruohoand 85a48c6c7aSjruoho.Vt int_least64_t 86a48c6c7aSjruohoprovide the smallest memory footprint signed integer type with 87a48c6c7aSjruohoa width of at least 8, 16, 32, or 64 bits, respectively. 88a48c6c7aSjruohoThe types 89a48c6c7aSjruoho.Vt uint_least8_t , 90a48c6c7aSjruoho.Vt uint_least16_t , 91a48c6c7aSjruoho.Vt uint_least32_t , 92a48c6c7aSjruohoand 93a48c6c7aSjruoho.Vt uint_least64_t 94a48c6c7aSjruohoprovide the smallest memory footprint unsigned integer type with 95a48c6c7aSjruohoa width of at least 8, 16, 32, or 64 bits, respectively. 96a48c6c7aSjruohoThese types should be used when memory storage is of 97a48c6c7aSjruohoconcern, and when a specific size is not required. 98a48c6c7aSjruoho.Pp 99a48c6c7aSjruohoThe type 100a48c6c7aSjruoho.Vt intmax_t 101a48c6c7aSjruohoprovides a signed integer type large 102a48c6c7aSjruohoenough to hold any other signed integer. 103a48c6c7aSjruohoThe type 104a48c6c7aSjruoho.Vt uintmax_t 105a48c6c7aSjruohoprovides an unsigned integer type large 106a48c6c7aSjruohoenough to hold any other unsigned integer. 107a48c6c7aSjruohoThese types are generally the largest signed and unsigned 108a48c6c7aSjruohointeger types available on a specific architecture. 109a48c6c7aSjruoho.Pp 110a48c6c7aSjruohoThe type 111a48c6c7aSjruoho.Vt intptr_t 112a48c6c7aSjruohoprovides a signed integer type with the ability to hold a pointer to 113a48c6c7aSjruoho.Vt void , 114a48c6c7aSjruohothat can later be converted back to a pointer to 115a48c6c7aSjruoho.Vt void . 116a48c6c7aSjruoho.Pp 117a48c6c7aSjruohoThe type 118a48c6c7aSjruoho.Vt uintptr_t 119a48c6c7aSjruohoprovides an unsigned integer type with the ability to hold a pointer to 120a48c6c7aSjruoho.Vt void , 121a48c6c7aSjruohothat can later be converted back to a pointer to 122a48c6c7aSjruoho.Vt void . 1238969131aSjruoho.Sh SEE ALSO 12404ca1e2eSjruoho.Xr inttypes 3 , 125*ea330d8dSjruoho.Xr limits 3 , 12642c70522Sjruoho.Xr stdbool 3 , 12742c70522Sjruoho.Xr unistd 3 128a48c6c7aSjruoho.Sh STANDARDS 129a48c6c7aSjruohoThe 130a48c6c7aSjruoho.In stdint.h 131a48c6c7aSjruohoheader conforms to 132a48c6c7aSjruoho.St -isoC-99 133a48c6c7aSjruohoand 134a48c6c7aSjruoho.St -p1003.1-2001 . 135a48c6c7aSjruoho.Sh HISTORY 136a48c6c7aSjruohoThe 137a48c6c7aSjruoho.In stdint.h 138a48c6c7aSjruohoheader was first introduced in 1398969131aSjruoho.Nx 1.6 . 140