|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 03/11] public: xen.h: add definitions for UUID handling
Hi Jan, On 31.08.17 10:34, Jan Beulich wrote: This is a public header. As I understand it can be used by different compilers (gcc, icc, msvc, llvm, etc...). C89 have no restrictions to padding or alignment of fields in structures. No one can guarantee thatOn 30.08.17 at 18:20, <volodymyr_babchuk@xxxxxxxx> wrote: sizeof(xen_uuid_t.rfc422) == sizeof(xen_uuid_t.guid) == sizeof(xen_uuid_t.smccc) == 16 On all platforms. Using any compiler. With any compiler options.This is implementation defined ([1]). Standard says "This should present no problem unless binary data written by one implementation are read by another.". But in case of public headers, this structures can be written by one implementation and read by another. See my reply above. There absolutely no guarantees, that MSVC compiler will not add extra padding somewhere. This will impair interoperability. I think, this is why (amongst other reasons) WinAPI structures has dwSize as the first field. And this is why _IO* macros in Linux kernel use sizeof() to create ioctl number.BTW, I'm very interested how it can be guaranteed that structures defined in xen.h will have the same size and alignment on both sides of communication channel, taking into account, then we rely only on C89 standard.I don't understand this comment. But, as I can see, XEN code checks only magic or version. [1] http://port70.net/~nsz/c/c89/c89-draft.html#A.6.3.8 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |