填充和枚举 [英] padding and enums

查看:71
本文介绍了填充和枚举的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


数组保证在没有填充之前是连续的,或者在任何数组成员之后是

,但是enums怎么样? ?

Hi all,

arrays are guaranteed to be contiguous with no padding before or
after any array member , but what about enums ..???

推荐答案

aa ***** @ gmail。 com 写道:

数组保证在没有填充之前是连续的,或者

在任何数组成员之后,但是怎么样?枚举.. ???
arrays are guaranteed to be contiguous with no padding before or
after any array member , but what about enums ..???



嗯,他们呢?


枚举类型与某些实现定义兼容

整数类型。该类型可能有填充位。那是你要求的吗?


-

Keith Thompson(The_Other_Keith)< ks *** @ mib.org>

诺基亚

我们必须做点什么。这是事情。因此,我们必须这样做。

- Antony Jay和Jonathan Lynn,是部长

Um, what about them?

An enumerated type is compatible with some implementation-defined
integral type. That type may have padding bits. Is that what you''re
asking?

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"


4月4日,9日:38 * pm,Keith Thompson< ks ... @ mib.orgwrote:
On Apr 4, 9:38*pm, Keith Thompson <ks...@mib.orgwrote:

aark ... @ gmail.com写道:
aark...@gmail.com writes:

*数组保证在没有填充之前是连续的,或者在任何数组成员之后是

,但是enums怎么样.. ???
*arrays are guaranteed to be contiguous with no padding before or
after any array member , but what about enums ..???



嗯,他们怎么样?

枚举类型与某些实现定义兼容

整数类型。 *该类型可能有填充位。 *那是你要求的吗?


Um, what about them?

An enumerated type is compatible with some implementation-defined
integral type. *That type may have padding bits. *Is that what you''re
asking?



我只是想清除这个概念结构的疑问吗? >
填充也适用于枚举.. ???

I just wanted to clear the doubt that, whether the concept structure
padding also applies to enums ..???


在文章< f6 *************** *******************@1g2000prg.go oglegroups.com>,

< aa ***** @ gmail.comwrote:
In article <f6**********************************@1g2000prg.go oglegroups.com>,
<aa*****@gmail.comwrote:

> 4月4日,9:38 = A0pm,Keith Thompson< ks ... @ mib.orgwrote:
>On Apr 4, 9:38=A0pm, Keith Thompson <ks...@mib.orgwrote:

> aark ... @ gmail.com写道:
>aark...@gmail.com writes:

= A0arrays保证连续,之前没有填充或

在任何数组成员之后,但是enums怎么样.. ???
=A0arrays are guaranteed to be contiguous with no padding before or
after any array member , but what about enums ..???


>嗯,他们怎么样?
>Um, what about them?


>枚举类型与某些实现定义的
整数类型兼容。 = A0该类型可能有填充位。 = A0是你问的问题?
>An enumerated type is compatible with some implementation-defined
integral type. =A0That type may have padding bits. =A0Is that what you''re
asking?


我只想清除疑问,概念结构
填充是否也适用于枚举.. ?? ?
I just wanted to clear the doubt that, whether the concept structure
padding also applies to enums ..???



关于数组的原始措辞不完全正确。

有可能在最后一个数组成员之后进行填充/>
a结构。例如:


struct foo {char bar [3]; int baz};


然后可以在bar [2]之后和baz之前填充。

枚举类型是一些整数类型(实现定义的),

因此适用于其他整体类型的规则同样适用。

-

他编织了一个很棒的网络知识,把所有东西连在一起,

并谦虚地坐在中心的交换机上,渴望提供帮助。

- Walter Kerr

Your original wording about arrays is not completely correct.
It is possible for there to be padding after the final array member in
a structure. For example:

struct foo { char bar[3]; int baz };

then there could be padding after bar[2] and before baz.
An enumeration type is some integral type (implementation-defined which),
so the same rules apply to it as apply to other integral types.
--
"He wove a great web of knowledge, linking everything together,
and sat modestly at a switchboard at the center, eager to help."
-- Walter Kerr


这篇关于填充和枚举的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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