char32_t
提供: cppreference.com
<tbody>
</tbody>
| ヘッダ <uchar.h> で定義
|
||
typedef uint_least32_t char32_t; |
(C11以上) | |
| ヘッダ <stdint.h> で定義
|
||
typedef /*implementation-defined*/ uint_least32_t; |
(C99以上) | |
char32_t は32ビットワイド文字のために使用される符号なし整数型であり、 uint_least32_t と同じ型です。
uint_least32_t は少なくとも32ビット以上の幅を持つ最も小さな符号なし整数型です。
ノート
任意のプラットフォームにおいて、 char32_t 型の幅は32ビットより大きい可能性がありますが、 char32_t 型のオブジェクトに格納される実際の値は常に32ビット幅です。
例
Run this code
#include <uchar.h>
#include <stdio.h>
int main(void)
{
char32_t wc[] = U"zß水🍌"; // or "z\u00df\u6c34\U0001f34c"
size_t wc_sz = sizeof wc / sizeof *wc;
printf("%zu UTF-32 code units: [ ", wc_sz);
for (size_t n = 0; n < wc_sz; ++n) printf("%#x ", wc[n]);
printf("]\n");
}
出力例:
5 UTF-32 code units: [ 0x7a 0xdf 0x6c34 0x1f34c 0 ]
参考文献
- C11 standard (ISO/IEC 9899:2011):
- 7.28 Unicode utilities <uchar.h> (p: 398)
- 7.20.1.2 Minimum-width integer types (p: 290)
- C99 standard (ISO/IEC 9899:1999):
- 7.18.1.2 Minimum-width integer types (p: 256)
関連項目
基本型 の C++リファレンス
|