hi, Andrew:
Thanks!
best wishes,
发件人: Andrew Fish [mailto:af...@apple.com]
发送时间:2012年8月24日 10:55
收件人: edk2-devel@lists.sourceforge.net
主题: Re: [edk2] #pragma pack(1) question
Nicolas,
#pragma pack() aligns to the C ABI convention. #pragma pack(1) byte packs the
structure.
The EFI C ABI is carefully defined in the UEFI specification to be the same for
all processor architectures. Per UEFI spec:
2.3.1 Data Types
Table 6 lists the common data types that are used in the interface definitions,
and Table 7 lists their modifiers. Unless otherwise specified all data types
are naturally aligned. Structures are aligned on boundaries equal to the
largest internal datum of the structure and internal data are implicitly padded
to achieve natural alignment.
So #pragma pack(1) is only required if you need to byte pack your structure.
So:
#pragma pack (1)
struct {
UINT32 One;
UINT64 Two;
} EXAMPLE_12_BYTE_STRUCT;
#pragma pack()
struct {
UINT32 One;
UINT64 Two;
} EXAMPLE_16_BYTE_STRUCT;
Andrew Fish
On Aug 23, 2012, at 7:21 PM, nicolas wrote:
hi, experts:
I found using "#pragma pack()" pre-compile syntax for some data structs, but
not for some other data struct in MdePkg\Include\Protocol\Dhcp6.h .
So, is there some considerations for using this pre-compile syntx?
If i used "#pragma pack()" pre-compile syntax for all my own defined data
structs, having any side effects?or not.
best wishes,
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats.
http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel