简体   繁体   English

裸 char32_t 是有符号还是无符号?

[英]Is a naked char32_t signed or unsigned?

Similarly, is a naked char16_t signed or unsigned?同样,裸char16_t是有符号的还是无符号的? Is it implementation defined?是否定义了实现?

From the standard (pre-C++11 draft n3290, or post-C++11 draft n3337) §3.9.1 Fundamental types :从标准(前 C++11 草案 n3290,或后 C++11 草案 n3337)§3.9.1基本类型

Types char16_t and char32_t denote distinct types with the same size, signedness, and alignment as uint_least16_t and uint_least32_t , respectively, in <stdint.h> , called the underlying types.类型char16_tchar32_t分别表示在<stdint.h>uint_least16_tuint_least32_t具有相同大小、符号和对齐的不同类型,称为基础类型。

uint_least16_t and uint_least32_t are both unsigned (from §18.4.1 Header <cstdint> synopsis ), so same for char16_t and char32_t . uint_least16_tuint_least32_t都是无符号的(来自 §18.4.1 Header <cstdint>概要),因此char16_tchar32_t相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM