Path: csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: Passing values from structure arrays to a generic geometrical mean function Date: Fri, 27 Jan 2017 11:50:34 -0800 Organization: None to speak of Lines: 32 Message-ID: References: <8abfc054-e7c3-498c-a7b4-8e7471f57ac6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="7ccb5db651c5d414defb0728956f1471"; logging-data="9836"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19//XrQjzTpF1hEf08Wvn7z" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:Kgtnk7axZBvIfJcsotQfhn+3wvA= sha1:cd883AIVeq0xwZQqHbr6kHhfYk4= Xref: csiph.com comp.lang.c:102593 supercat@casperkitty.com writes: > On Friday, January 27, 2017 at 11:25:11 AM UTC-6, Keith Thompson wrote: >> I think there are cases where non-deterministic incorrect behavior >> is better than deterministic incorrect behavior. >> >> Suppose a bug in a program causes it to produce a plausible but >> incorrect result. If it consistently produces that result, you might >> never detect the error. If different runs produce different results, >> some of them may be sufficiently bad to make the bug obvious. >> >> It depends, in part, on whether testing can reliably reveal the >> problem before the code goes into production, and on the consequences >> of incorrect results -- and that can be arbitrarily complicated. > > In many cases, "non-deterministic" results will depend upon things which > may not change terribly often, but may change in response to things which > should have no causal relationship with them. While a compiler option to > deliberately randomize uninitialized variables might occasionally help in > tracking down places where they cause problems in code *which doesn't need > to be compatible with "clever" compilers*, deterministic behavior is far > easier to diagnose than behavior which might change arbitrarily, but usually > doesn't. Sometimes it is, sometimes it isn't. It isn't if the deterministic results are plausible but incorrect. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"