Has someone encountered similar issues with -cov?
Patrick Schluter via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jul 1 12:43:05 PDT 2016
On Friday, 1 July 2016 at 16:30:41 UTC, Andrei Alexandrescu wrote:
> https://issues.dlang.org/show_bug.cgi?id=16224 -- Andrei
That
do {
} while(0)
construct is ridiculous. It's cargo cult at its worst. It is NOT
more readable than an honest to god goto. It's an obfuscated way
to write naughty gotos without the guilt of sinning (I
deliberately use religous vocabulary because it is a religious
disease). It's the goto of the hypocrits.
Sorry if I sound harsh, but I share a project (in C) with a
colleague who loves that construct and after almost 15 years of
having to debug that sh... I can affirm that that construct is a
scourge and deserves all the scorn that can be heaped on it.
It looks like a loop, but isn't one.
It doesn't look like a goto, but is one.
It's horribly difficult to amend, especially if there is actually
a real loop somewhere around or inside it.
It pushes the user to write unnecessary big functions (anecdote,
I modified once a 200 lines do while(0) behemoth that could be
reduced to 4 functions of 10 lines each and a small loop. After
conversion and simplification I discovered that the original
didn't even cover all functional cases and leaked some memory).
I don't think it makes even an inkling of sense to use it in D as
there are real language constructs that can cleanly replace it
(scope, try/catch/finally, destructors, etc.).
More information about the Digitalmars-d
mailing list