Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!mit.eternal-september.org!.POSTED!not-for-mail From: Richard Newsgroups: comp.lang.c Subject: Re: Is goto Still Considered Harmful? Date: Sat, 05 Apr 2014 15:21:58 +0100 Organization: http://www.ieee.org/ Lines: 27 Message-ID: <87sipr26wp.fsf@gmail.com> References: <4a3ec9a9-ccad-40d5-a78c-ae4c7a55fc99@googlegroups.com> <9f6dcb67-571b-40c5-9ac0-9f9b4ab661fe@googlegroups.com> <20140325084738.938@kylheku.com> <5339BFE3.9010703@verizon.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mit.eternal-september.org; posting-host="1a3dbcbbf200d902af62260a82722e29"; logging-data="16109"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+pKGHSMun8lxXQY8yVWLTu6Aey+RK381M=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) Cancel-Lock: sha1:FrBC97E1tnuAEViuo1S1CZjunzk= sha1:d1NFMnnX6bia+NDVYn/GY/qM87A= Xref: csiph.com comp.lang.c:42594 Stephen Sprunk writes: > On 31-Mar-14 14:20, James Kuyper wrote: >> On 03/31/2014 03:05 PM, Stephen Sprunk wrote: >>> Unit tests mean _every_ function is called from at least two places. >> >> That depends upon how you define unit tests. For purposes of unit >> testing, I treat functions with internal linkage as part of the >> function(s) with external linkage in the same translation unit that >> (directly or indirectly) call them. If they have any feature which >> cannot be properly tested through calls to those externally linked >> functions, then that generally means that the feature is either >> unnecessary or at least badly designed. > > To me, the purpose of unit testing is to prove the code is correct (as > defined by the design docs), and one cannot prove a function is correct > until you've proven that all the functions it _calls_ are correct. I've > chased down too many bugs where function X calls function Y with an > invalid argument and got a result that seemed reasonable--until one day > (or once in a blue moon) it didn't. If you test function Y, that's one > less thing to worry about when testing (or troubleshooting) function X. That's a lot of words for "sw has bugs and you need to test it". -- "Avoid hyperbole at all costs, its the most destructive argument on the planet" - Mark McIntyre in comp.lang.c