Sujet : Re: Fixing a sample from K&R book using cake static analyser
De : ben (at) *nospam* bsb.me.uk (Ben Bacarisse)
Groupes : comp.lang.cDate : 25. Jun 2024, 14:06:43
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87v81xmasc.fsf@bsb.me.uk>
References : 1 2 3 4 5 6 7 8 9 10
User-Agent : Gnus/5.13 (Gnus v5.13)
Kaz Kylheku <
643-408-1753@kylheku.com> writes:
On 2024-06-24, Lawrence D'Oliveiro <ldo@nz.invalid> wrote:
On Mon, 24 Jun 2024 11:53:51 +0100, Ben Bacarisse wrote:
>
Lawrence D'Oliveiro <ldo@nz.invalid> writes:
Too many different paths in the control flow, though. I think it’s a
good idea to minimize that.
Your non-solution has more.
>
My solution only has one major flow of control: in the top and out the
bottom.
>
This is false. Every branch in the code creates a separate control
flow path.
L D'O is surely just trolling. Do you think he actually considers his
non-solution to be a good bit of code? Do you think he really doesn't
know what a path through some code is? He's making up terms like "major
flow of control" just to keep people talking, and I admit it's working!
Everything else is error checks, and it is quite obvious where
they all go--through the same cleanup path.
>
Your solution intertwines both cases together and jumbles the error
handling between other logic, requiring the reader to untangle all
that.
And it's not a solution. It has both a syntax error and a case missing
(replacing an existing definition). I think he's just chucking code out
there to get a reaction. It wasn't obvious at first because old-style
trolls are so rare these days
-- Ben.