[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lmi] [lmi-commits] master 27fbf8ca 8/9: Rewrite unit-test macros to
From: |
Greg Chicares |
Subject: |
Re: [lmi] [lmi-commits] master 27fbf8ca 8/9: Rewrite unit-test macros to allow invocation with terminal '; ' |
Date: |
Sat, 30 Jul 2022 21:42:04 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 |
On 7/30/22 13:25, Vadim Zeitlin wrote:
> On Fri, 29 Jul 2022 20:42:33 -0400 (EDT) Greg Chicares
> <gchicares@sbcglobal.net> wrote:
[...]
> GC> Rewrite unit-test macros to allow invocation with terminal ';'
>
> FWIW, using "while(0)" like this results in warnings from MSVC, which is
> why wx uses
>
> #define wxSTATEMENT_MACRO_BEGIN do {
> #define wxSTATEMENT_MACRO_END } while ( (void)0, 0 )
Let me guess: they tell us that '0' is always 'false'.
If we were to replace the last line of that hoary old C idiom
with "while(false)", would msvc recognize our manifest intent
and issue no warning? Just curious.
> although I can't reproduce it with the latest version any more (see
> https://godbolt.org/z/W8Kh7dE3n), so maybe it's not really a problem.
Then it doesn't matter, unless you're going to be using an older
version of msvc.
> OTOH using these wx helper macros might be considered more readable than
> just "bare" do..while(0) loop.
OTTH adding two macros doesn't help us converge toward the
ideal number of macros, which is ( (void)0, 0 ).