是否有缺少固定宽度类型(intXX_t)的平台? [英] Are there any platforms where fixed width types (intXX_t) are missing?

查看:64
本文介绍了是否有缺少固定宽度类型(intXX_t)的平台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C ++ 11具有固定宽度,2的补码类型:(u)int8_t (u)int16_t ,等等。

C++11 has fixed width, 2's complement types: (u)int8_t, (u)int16_t, etc.

但是,这些类型是可选的。

However, these types are optional.

有时我需要使用这些类型,所以我的因此,代码可能不太容易移植。

Sometimes I need to use these types, so my code might be less portable because of this.

当前是否有任何平台(可使用C + 11编译器),而这些类型没有是不是存在?

Is there any platform (with C+11 compiler available) currently, where these types don't exist?

是否有任何通用(我知道这是一个模糊的词,但我想提供一个答案,其中DSP和其他领域专用平台被排除在外,因为这些平台目前很少是移植软件的目标)平台,这些类型不存在?

Is there any "general-purpose" (I know it's a vague word, but I'd like to have an answer, where DSP's and other very domain-specific platforms are excluded, as these platforms are rarely a target for porting software) platform currently, where these types don't exist?

注1:我知道,有些硬件不支持这些类型。但是,我所知道的所有此类硬件都没有符合C ++ 11的编译器。这个问题是关于C ++ 11实现的,实际上缺少固定宽度类型。

Note 1: I know, that there is hardware which doesn't support these types. However, all such hardware I know doesn't have a C++11 conformant compiler. This question is about a C++11 implementation, where fixed width types are actually missing.

注2:我知道,有强制性的最少 fast 类型,但是这个问题与确切的宽度类型有关。

Note 2: I know, that there are mandatory least and fast types, but this question is about exact width types.

推荐答案

intXX_t 仅在互为补充平台上可用,其中 CHAR_BIT 是2的幂。但是,即使在那些平台上,也不是所有 intXX_t 都存在。例如, CHAR_BIT == 16 的DSP显然不能具有 int8_t 。在 CHAR_BIT == 24 CHAR_BIT == 32 <的DSP上将没有 int16_t / code>。

intXX_t are only possible on two's complement platforms where CHAR_BIT is a power of 2. But even on those platforms not all intXX_t may exist. For example DSPs where CHAR_BIT == 16 obviously can't have int8_t. There will be no int16_t on DSPs where CHAR_BIT == 24 or CHAR_BIT == 32.

一个例子是TI C2000系列。它具有 C99支持,因此它确实有 stdint.h 。不幸的是,它还没有C ++ 11支持,但是还有许多其他TI DSP 像C6000一样也具有C ++ 14支持

One example is the TI C2000 series. It has C99 support, so it does have stdint.h. Unfortunately it doesn't have C++11 support yet but many other TI DSPs like C6000 do have C++14 support

另一个例子是 SHARC DSP,其中 CHAR_BIT == 32 并同时支持C99和C ++ 11

Another example is the SHARC DSPs where CHAR_BIT == 32 and have both C99 and C++11 support

这些类型也不会存在一个人的补码和符号幅度平台。

Those types will also not exist one one's complement and sign-magnitude platforms.

这篇关于是否有缺少固定宽度类型(intXX_t)的平台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆