Hi Michael! Thanks for answer.

> Converting these to a flexible array member would not be
a backwards compatible change.

That's the point. But at least when I see the compiler used in tool_def.txt,
there's no compiler which doesn't support to flexible array member.

Do we still need to consider the case building edk2 with lower version of 
comipler
which isn't manifested in tool_def.txt?

Thanks!


________________________________________
From: Kinney, Michael D <michael.d.kin...@intel.com>
Sent: 03 April 2024 17:17
To: devel@edk2.groups.io; Yeo Reum Yun
Cc: nd; Sami Mujawar; Kinney, Michael D
Subject: RE: [edk2-devel] [Question] using Flexible Array Member in Structure.

Yes.  Use of flexible array members is supported and encouraged.

There are challenges with existing structure definitions that declare
arrays of size [1] when a flexible array is really intended. Those
were defined before flexible array members were supported by all the
compilers.  Converting these to a flexible array member would not be
a backwards compatible change.

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
> levi.yun
> Sent: Wednesday, April 3, 2024 2:27 AM
> To: devel@edk2.groups.io
> Cc: n...@arm.com; sami.muja...@arm.com
> Subject: [edk2-devel] [Question] using Flexible Array Member in
> Structure.
>
> 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 (#117453): https://edk2.groups.io/g/devel/message/117453
Mute This Topic: https://groups.io/mt/105305209/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to