From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id E2A72740032 for ; Mon, 21 Oct 2024 20:22:01 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=3bK8TOBgEwG4Bx2PYc9IuJixHtA6jcNc2uQ9PlljXwA=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240830; t=1729542121; v=1; x=1729801320; b=G/5oMafv7WBUeL7upmMgzD33NtoMMocGw25avq4laJrRFQ3rCzVrVnlIloBpWHZUlAwmHJ6h uqQ7wneTqVuy01CnUzC8uMGLTJqmuH4BbgdaS9VvyyEik+6M2SGz4IHfYuoOjS3VpcekCnPHjuB 1jmPAydCGMTr4iN3H8Q+Z/KM1HKpXDz057+okbj0iNGBpVuT9yTSCyYoAMfq5OXSuCcOIra2nXT bE1h8sf4iTkh5rCitchTFoo1a8/KVC+9T6H6SPkQH4HwFaLiOfcWVezQ5YSTwnQ4KL3xFgTUjf2 iu3mqPaMeD0ZK+FUvHD8opz8qrDuVF/otnuJe71L4gSBw== X-Received: by 127.0.0.2 with SMTP id hufXYY7687511xOBoP8HXqGo; Mon, 21 Oct 2024 13:22:00 -0700 X-Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com [209.85.221.170]) by mx.groups.io with SMTP id smtpd.web11.2407.1729542119453883644 for ; Mon, 21 Oct 2024 13:21:59 -0700 X-Received: by mail-vk1-f170.google.com with SMTP id 71dfb90a1353d-50d494ac189so1423334e0c.3 for ; Mon, 21 Oct 2024 13:21:59 -0700 (PDT) X-Gm-Message-State: 5sKNyusphQP03Sbs4E5G4oakx7686176AA= X-Google-Smtp-Source: AGHT+IGr+hplOgqEjqOfmQgOEI1GmpYKBgqKatOpVU1Tt4jz0gOsxbqFMwI4FJZnYki5VD0YO1XRRkGRawGYQG4nt5w= X-Received: by 2002:a05:6122:468d:b0:50d:535b:a18a with SMTP id 71dfb90a1353d-50dda1d2d31mr8459765e0c.6.1729542118419; Mon, 21 Oct 2024 13:21:58 -0700 (PDT) MIME-Version: 1.0 References: <20241011012040.274642-1-rebecca@bsdio.com> <591659ac-1d4a-43bd-b953-1032e5a7b8b0@linux.microsoft.com> In-Reply-To: <591659ac-1d4a-43bd-b953-1032e5a7b8b0@linux.microsoft.com> From: "Pedro Falcato" Date: Mon, 21 Oct 2024 21:21:47 +0100 Message-ID: Subject: Re: [edk2-devel] [edk2-CCodingStandardsSpecification PATCH 1/1] Prefer use of `static` C keyword over EDK2 type `STATIC` To: Oliver Smith-Denny Cc: devel@edk2.groups.io, rebecca@bsdio.com, "Kinney, Michael D" Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Mon, 21 Oct 2024 13:21:59 -0700 Resent-From: pedro.falcato@gmail.com Reply-To: devel@edk2.groups.io,pedro.falcato@gmail.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b="G/5oMafv"; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io On Mon, Oct 21, 2024 at 9:05=E2=80=AFPM Oliver Smith-Denny wrote: > > On 10/21/2024 12:42 PM, Pedro Falcato wrote: > > On Mon, Oct 21, 2024 at 3:49=E2=80=AFPM Rebecca Cran via groups.io > > wrote: > >> > >> Thanks, I'll fix it. > >> > >> Could you confirm whether the change from STATIC to static is somethin= g > >> 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=3D (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-typ= es 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 =3D 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). --=20 Pedro -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- 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/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-