public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [Question] using Flexible Array Member in Structure.
@ 2024-04-03  9:27 levi.yun
  2024-04-03 16:17 ` Michael D Kinney
  2024-04-05  7:34 ` Pedro Falcato
  0 siblings, 2 replies; 5+ messages in thread
From: levi.yun @ 2024-04-03  9:27 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: nd@arm.com, sami.mujawar@arm.com

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;

In here, why MemoryDeviceStructure should remain with comments?

IIUC, edk2 coding style guide doesn't seem to prevent use of Flexible 
Array Member which is C99 standard.

And consider the compiler used to compile edk2 uses defaults standard 
above of C99 standard.

Couldn't I use the flexible array member like:

///
/// 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[]
}

Thanks!


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#117365): https://edk2.groups.io/g/devel/message/117365
Mute This Topic: https://groups.io/mt/105305209/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-04-05  7:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-03  9:27 [edk2-devel] [Question] using Flexible Array Member in Structure levi.yun
2024-04-03 16:17 ` Michael D Kinney
2024-04-05  6:43   ` levi.yun
2024-04-05  7:29     ` Pedro Falcato
2024-04-05  7:34 ` Pedro Falcato

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox