Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Malcolm McLean Newsgroups: comp.lang.c Subject: Re: filling area by color atack safety Date: Sun, 17 Mar 2024 12:37:08 +0000 Organization: A noiseless patient Spider Lines: 49 Message-ID: References: <87wmq2jn7s.fsf@bsb.me.uk> <87frwpje2b.fsf@bsb.me.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sun, 17 Mar 2024 12:37:09 -0000 (UTC) Injection-Info: dont-email.me; posting-host="1302203e67d64edb589b5f20956e00a5"; logging-data="3706251"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/hhNwaZR+JvzRUQh2uecWP/+nl9KeqUEc=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:YHhkOwv6DUbofburMtkHvs75sW8= In-Reply-To: <87frwpje2b.fsf@bsb.me.uk> Content-Language: en-GB Bytes: 3546 On 17/03/2024 11:25, Ben Bacarisse wrote: > Malcolm McLean writes: > >> On 16/03/2024 13:55, Ben Bacarisse wrote: >>> Malcolm McLean writes: >>> >>>> Recursion make programs harder to reason about and prove correct. >>> Are you prepared to offer any evidence to support this astonishing >>> statement or can we just assume it's another Malcolmism? >> >> Example given. A recursive algorithm which is hard to reason about and >> prove correct, because we don't really know whether under perfectly >> reasonable assumptions it will or will not blow the stack. > > Had you offered a proof that your code neither "blows the stack" nor > runs out of any other resource we'd have a starting point for > comparison, but you have not done that. > > Mind you, had you done that, we would have something that might > eventually become only one piece of evidence for what is an > astonishingly general remark. Broadly applicable remarks require either > broadly applicable evidence or a wealth of distinct cases. > > Your "rule" suggests that all reasoning is impeded by the presence of > recursion and I don't think you can support that claim. This is > characteristic of many of your remarks -- they are general "rules" that > often remain rules even when there is evidence to the contrary. > > I'll make another point in the hope of clarifying the matter. An > algorithm or code is usually proved correct (or not!) under the > assumption that it has adequate resources -- usually time and storage. > Further reasoning may then be done to determine the resource > requirements since this is so often dependent on context. This > separation is helpful as you don't usually want to tie "correctness" to > some specific installation. The code might run on a system with a > dynamically allocated stack, for example, that has very similar > limitations to "heap" memory. > > To put is more generally, we often want to prove properties of code that > are independent of physical constraints. Your remark includes this kind > reasoning. Did you intend it to? > The convetional wisdom is the opposite, But here, conventional wisdom fails. Because heaps are unlimited whilst stacks are not. -- Check out Basic Algorithms and my other books: https://www.lulu.com/spotlight/bgy1mm