On Mon, Oct 21, 2024 at 9:05 PM Oliver Smith-Denny <o...@linux.microsoft.com> wrote: > > On 10/21/2024 12:42 PM, Pedro Falcato wrote: > > On Mon, Oct 21, 2024 at 3:49 PM Rebecca Cran via groups.io > > <rebecca=bsdio....@groups.io> wrote: > >> > >> Thanks, I'll fix it. > >> > >> Could you confirm whether the change from STATIC to static is something > >> we want to go ahead with, or do we want to keep STATIC to allow > >> GoogleTest to work? > > > > You don't need STATIC, doing stuff like -Dstatic= (or just #define > > static in C code) Just Works. For GCC at least. > > > > proof of horribleness: https://godbolt.org/z/EvMd6hev8 > > > > The issue here is that C uses one keyword for two distinct things: > file private members and local variables that keep state across calls, > i.e. real static variables.
That's an interesting problem, but I'm afraid the current EDK2 coding style would recommend STATIC for local variables too. https://tianocore-docs.github.io/edk2-CCodingStandardsSpecification/release-2.20/5_source_files/56_declarations_and_types.html#56-declarations-and-types says: 5.6.1.2 The use of int, unsigned, char, void, static, long is a violation of the coding convention. so: INT Foo() { STATIC INT Variable = 0; return Variable++; } would be the sanctioned way to pull off this kind of stuff. So STATIC gains us nothing (neither does INT, LONG, CHAR, VOID, or CONST). -- Pedro -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#120639): https://edk2.groups.io/g/devel/message/120639 Mute This Topic: https://groups.io/mt/108941574/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-