On Wed, Apr 3, 2024 at 10:27 AM levi.yun <[email protected]> wrote: > > Hello all! > > while I see the code. I have one question related using Flexible Array > Member. > > For example) > > /// > /// Socket Type Data. > /// > typedef struct { > EFI_ACPI_6_4_PMTT_COMMON_MEMORY_DEVICE CommonMemoryDeviceHeader; > UINT16 SocketIdentifier; > UINT16 Reserved; > // EFI_ACPI_6_4_PMTT_COMMON_MEMORY_DEVICE MemoryDeviceStructure[]; > } EFI_ACPI_6_4_PMTT_SOCKET_TYPE_DATA; > > > /// > /// Socket Type Data. > /// > typedef struct { > EFI_ACPI_6_4_PMTT_COMMON_MEMORY_DEVICE CommonMemoryDeviceHeader; > UINT16 SocketIdentifier; > UINT16 Reserved; > EFI_ACPI_6_4_PMTT_COMMON_MEMORY_DEVICE MemoryDeviceStructure[] > }
This change might be okay. Both variants may be size (and layout)-equivalent. See https://godbolt.org/z/364e4T4a7. You need to check if e.g there's any padding after Reserved and before MemoryDeviceStructure. Basically make sure member offsets and sizes remain stable. Thanks, Pedro -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117455): https://edk2.groups.io/g/devel/message/117455 Mute This Topic: https://groups.io/mt/105305209/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
