> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man7/stdint.7.md).

# stdint.7

`stdint` — 标准整数类型

## 名称

`stdint`

## 概要

`#include <stdint.h>`

## 描述

`#include <stdint.h>`

头文件提供具有特定大小、最小内存占用且满足最小大小要求、最快访问速度且满足最小大小要求、最大整数大小以及能够存储指针的源代码可移植整数类型。

类型 `int8_t`、`int16_t`、`int32_t` 和 `int64_t` 分别提供宽度为 8、16、32 或 64 位的有符号整数类型。类型 `uint8_t`、`uint16_t`、`uint32_t` 和 `uint64_t` 分别提供宽度为 8、16、32 或 64 位的无符号整数类型。当需要特定大小时应使用这些整数类型。

类型 `int_fast8_t`、`int_fast16_t`、`int_fast32_t` 和 `int_fast64_t` 分别提供宽度至少为 8、16、32 或 64 位的最快有符号整数类型。类型 `uint_fast8_t`、`uint_fast16_t`、`uint_fast32_t` 和 `uint_fast64_t` 分别提供宽度至少为 8、16、32 或 64 位的最快无符号整数类型。当访问速度至关重要且不需要特定大小时，应使用这些类型。

类型 `int_least8_t`、`int_least16_t`、`int_least32_t` 和 `int_least64_t` 分别提供宽度至少为 8、16、32 或 64 位的最小内存占用有符号整数类型。类型 `uint_least8_t`、`uint_least16_t`、`uint_least32_t` 和 `uint_least64_t` 分别提供宽度至少为 8、16、32 或 64 位的最小内存占用无符号整数类型。当关注内存存储且不需要特定大小时，应使用这些类型。

类型 `intmax_t` 提供足够大的有符号整数类型，可容纳任何其他有符号整数。类型 `uintmax_t` 提供足够大的无符号整数类型，可容纳任何其他无符号整数。这些类型通常是特定架构上可用的最大有符号和无符号整数类型。

类型 `intptr_t` 提供能够容纳指向 `void` 的指针的有符号整数类型，该类型随后可转换回指向 `void` 的指针。

类型 `uintptr_t` 提供能够容纳指向 `void` 的指针的无符号整数类型，该类型随后可转换回指向 `void` 的指针。

此外，

`#include <stdint.h>`

头文件定义了一些宏，但此处不对其进行文档说明。

## 标准

`#include <stdint.h>`

头文件遵循 ISO/IEC 9899:1999（"ISO C99"）和 IEEE Std 1003.1-2001（"POSIX.1"）

## 历史

`#include <stdint.h>`

头文件首次引入于 FreeBSD 5.0。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man7/stdint.7.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
