GCC:哪些目标支持定点类型?
GCC: which targets support fixed-point types?
$ echo "_Fract x;" | gcc -xc -
<stdin>:1:1: error: fixed-point types not supported for this target
As an extension, GNU C supports fixed-point types as defined in the N1169 draft of ISO/IEC DTR 18037. Support for fixed-point types in GCC will evolve as the draft technical report changes. Calling conventions for any target might also change. Not all targets support fixed-point types.
问题:哪些目标支持定点类型?
额外:有记录吗?如何从GCC的源代码中导出?
更新。可能有用:Clang 确实通过选项 -ffixed-point
:
支持定点类型
$ echo "_Fract x;" | clang -xc - -c -ffixed-point
# OK
我可以确认 GCC 11.2.0 在 AVR 上确实支持 fixed-point 类型。尺码为:
sizeof(signed short _Fract) == 1
sizeof(unsigned short _Fract) == 1
sizeof(signed _Fract) == 2
sizeof(unsigned _Fract) == 2
sizeof(signed long _Fract) == 4
sizeof(unsigned long _Fract) == 4
sizeof(signed long long _Fract) == 8
sizeof(unsigned long long _Fract) == 8
sizeof(signed short _Accum) == 2
sizeof(unsigned short _Accum) == 2
sizeof(signed _Accum) == 4
sizeof(unsigned _Accum) == 4
sizeof(signed long _Accum) == 8
sizeof(unsigned long _Accum) == 8
sizeof(signed long long _Accum) == 8
sizeof(unsigned long long _Accum) == 8
$ echo "_Fract x;" | gcc -xc -
<stdin>:1:1: error: fixed-point types not supported for this target
As an extension, GNU C supports fixed-point types as defined in the N1169 draft of ISO/IEC DTR 18037. Support for fixed-point types in GCC will evolve as the draft technical report changes. Calling conventions for any target might also change. Not all targets support fixed-point types.
问题:哪些目标支持定点类型?
额外:有记录吗?如何从GCC的源代码中导出?
更新。可能有用:Clang 确实通过选项 -ffixed-point
:
$ echo "_Fract x;" | clang -xc - -c -ffixed-point
# OK
我可以确认 GCC 11.2.0 在 AVR 上确实支持 fixed-point 类型。尺码为:
sizeof(signed short _Fract) == 1
sizeof(unsigned short _Fract) == 1
sizeof(signed _Fract) == 2
sizeof(unsigned _Fract) == 2
sizeof(signed long _Fract) == 4
sizeof(unsigned long _Fract) == 4
sizeof(signed long long _Fract) == 8
sizeof(unsigned long long _Fract) == 8
sizeof(signed short _Accum) == 2
sizeof(unsigned short _Accum) == 2
sizeof(signed _Accum) == 4
sizeof(unsigned _Accum) == 4
sizeof(signed long _Accum) == 8
sizeof(unsigned long _Accum) == 8
sizeof(signed long long _Accum) == 8
sizeof(unsigned long long _Accum) == 8