enum类型大小问题

ilovedrv 2003-02-24 11:00:50
enum枚举类型在Builder中可以设置为16位或32位大小,可以通过IDE环境设置,请问有没有在文件中通过编译器语法设置其大小的?
...全文
130 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
xinghf 2003-02-24
  • 打赏
  • 举报
回复
gz
myy 2003-02-24
  • 打赏
  • 举报
回复
#pragma option -b

=========================================

(Command-line switch: -b)

When the Treat Enums As Ints option is set, the compiler always allocates a whole word (a four-byte int for 32-bit programs) for enumeration types (variables of type enum).

When this option is off (-b-), the compiler allocates the smallest integer that can hold the enumeration values: the compiler allocates an unsigned or signed char if the values of the enumeration are within the range of 0 to 255 (minimum) or -128 to 127 (maximum), or an unsigned or signed short if the values of the enumeration are within the following ranges:

0 to 4,294,967,295 or -2,147,483,648 to 2,147,483,647

The compiler allocates a four-byte int (32-bit) to represent the enumeration values if any value is out of range.

Default = ON
myy 2003-02-24
  • 打赏
  • 举报
回复
我想是:

#pragma xxxxx

具体咋写,我也不知。 :(
BCB 2003-02-24
  • 打赏
  • 举报
回复
有,邦助我就见过,要查一下


13,825

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder相关内容讨论区
社区管理员
  • 基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧