public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Oliver Smith-Denny" <osde@linux.microsoft.com>
To: devel@edk2.groups.io, rebecca@bsdio.com,
	Sean Brogan <spbrogan@outlook.com>,
	Michael Kinney <michael.d.kinney@intel.com>
Subject: Re: [edk2-devel] [edk2-CCodingStandardsSpecification PATCH 1/1] Prefer use of `static` C keyword over EDK2 type `STATIC`
Date: Mon, 14 Oct 2024 10:09:39 -0700	[thread overview]
Message-ID: <576d27b9-2bac-4b44-b864-6eca9f57219e@linux.microsoft.com> (raw)
In-Reply-To: <4e1f3410-b1f6-4f26-a04f-67f2a9cdcfcb@bsdio.com>

On 10/14/2024 9:47 AM, Rebecca Cran wrote:
> On 10/14/24 9:22 AM, Oliver Smith-Denny wrote:
>> In GoogleTest, you often cannot directly include the C file in the
>> GoogleTest file, because C++ complains about many Cisms, mostly
>> our use of casting.
> 
> Do you have an example of that?

This was a little while back, so my only memory is of the Mu code I
updated the STATIC undef'ing for, one of these two:

https://github.com/microsoft/mu_plus/blob/dev/202405/AdvLoggerPkg/AdvLoggerOsConnectorPrm/GoogleTest/AdvLoggerOsConnectorPrmGoogleTest.cpp

https://github.com/microsoft/mu_plus/blob/dev/202405/AdvLoggerPkg/AdvLoggerOsConnectorPrm/Library/AdvLoggerOsConnectorPrmConfigLib/GoogleTest/AdvLoggerPrmConfigLibGoogleTest.cpp

We had issues in edk2 as well, I just don't remember specific examples.
It is more likely than not that if you try to write a GoogleTest and
include the C file you'll fail compilation.

> 
> Also, I've seen suggestions (I think on the FreeBSD mailing lists) of 
> using C++ as "a better C". That is, not using any C++ specific features 
> but building the code as C++ because apparently you get better code 
> checking and diagnostics with it. Though you do lose some features like 
> implicit casts from void* when using C++.

I would take umbrage with the statement that C++ is a better C :). I do
not think we gain value and in fact lose quite a lot of things,
name mangling, lots of churn, etc.

TBH, I have not been convinced of the value of adding C++ into edk2 with
GoogleTest, I think it has added complications and very few new edk2
unit tests. Hopefully platform owners are getting good usage out of it.

Oliver





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#120622): https://edk2.groups.io/g/devel/message/120622
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]
-=-=-=-=-=-=-=-=-=-=-=-



  reply	other threads:[~2024-10-14 17:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11  1:20 [edk2-devel] [edk2-CCodingStandardsSpecification PATCH 1/1] Prefer use of `static` C keyword over EDK2 type `STATIC` Rebecca Cran
2024-10-11  3:41 ` Sean
2024-10-11 16:47   ` Rebecca Cran
2024-10-14 15:22     ` Oliver Smith-Denny
2024-10-14 16:47       ` Rebecca Cran
2024-10-14 17:09         ` Oliver Smith-Denny [this message]
2024-10-15 21:12 ` Michael D Kinney
2024-10-21 14:49   ` Rebecca Cran
2024-10-21 15:46     ` Michael D Kinney
2024-10-21 19:42     ` Pedro Falcato
2024-10-21 20:05       ` Oliver Smith-Denny
2024-10-21 20:21         ` Pedro Falcato
2024-10-21 20:26           ` Oliver Smith-Denny
2024-10-21 20:35             ` Michael D Kinney
2024-10-21 20:37               ` Oliver Smith-Denny
2024-10-21 21:04                 ` Michael D Kinney
2024-10-21 21:11                   ` Pedro Falcato

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=576d27b9-2bac-4b44-b864-6eca9f57219e@linux.microsoft.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox