在 2013-06-05三的 05:49 -0700,Richard Henderson写道: > On 06/04/2013 06:56 PM, li guang wrote: > >> > +typedef struct { > >> > + uint32_t len __attribute__((aligned((sizeof(void *))))); > >> > + uint32_t cie_offset; > >> > + tcg_target_long func_start __attribute__((packed)); > >> > + tcg_target_long func_len __attribute__((packed)); > > suspicious usage of packed attribute here, > > since tcg_targe_long is either 32 or 64 bits, > > not a struct or union. > > > > Thanks! > > > > Your question is worded poorly -- what has struct/union got to do with it? > One > can adjust the alignment of any type. Perhaps you don't know what it is that > __attribute__((packed)) actually does?
referred from gcc manual: "This attribute, attached to struct or union type definition, specifies that each member (other than zero-width bitfields) of the structure or union is placed to minimize the memory required." so, what I mean is as the manual said, this attribute mostly applies to struct or union. > > While it's true that for ARM all four of these data members are 32-bit, and > thus none of the attributes are required, it's not actually wrong. Given that > this sort of boiler-plate tends to get copied from target to target, and since > the attributes *are* required for 64-bit hosts, forgive me if the question is fool, packed means seize minimal memory size, right? and any chance tcg_target_long smaller than 64 bits in 64-bit case? > I prefer to keep all such > structures defined similarly. > > > r~