Liste des Groupes | Revenir à cl c |
Richard Harnden <richard.nospam@gmail.invalid> writes:I think your "for" solution would raise far more questions to any reader than idiomatic "do ... while (0)" would, or even if ((0)). I really don't understand your reactions at all.
On 14/03/2025 21:10, Keith Thompson wrote:These examples illustrate why I have the reaction I do. That
>Tim Rentsch <tr.17687@z991.linuxsc.com> writes:>
>Richard Harnden <richard.nospam@gmail.invalid> writes:
>On 14/03/2025 16:44, Tim Rentsch wrote:>
>for( int just_once = 1; just_once; just_once = 0 ){>
Any reason not to say ...
>
do {
...
} while (0);
>
... ?
In fact using do/while(0) is what I first wrote. But then
I thought, oh wait, what if an overzealous compiler gives
a warning because the while() expression is always false? :-/
That would break a lot of macros :)
>[...]>
Hmm, clang with -Weverything is okay with:
do { ... } while (0);
>
But not with:
if ( 0 ) { ... }
>
But it's okay with:
if ( (0) ) { ... }
plus the lack of clarity as to what the OP's actual requirements
are explains my decision to use a for() rather than do/while(0).
Les messages affichés proviennent d'usenet.