Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Everybody is talking about the weather but nobody does anything about it." -- Mark Twain


devel / comp.lang.c / Re: Has "stack overflow" specified behavior?

SubjectAuthor
o Re: Has "stack overflow" specified behavior?James Kuyper

1
Re: Has "stack overflow" specified behavior?

<sp7um7$spv$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=19391&group=comp.lang.c#19391

  copy link   Newsgroups: comp.lang.c
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Newsgroups: comp.lang.c
Subject: Re: Has "stack overflow" specified behavior?
Date: Mon, 13 Dec 2021 12:08:23 -0500
Organization: A noiseless patient Spider
Lines: 40
Message-ID: <sp7um7$spv$1@dont-email.me>
References: <f5624610-cbe0-4e27-9f52-f4a900172c89n@googlegroups.com>
<sp61ti$phb$1@dont-email.me> <sp6mqk$uob$1@gioia.aioe.org>
<j1oj05Fk7miU1@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 13 Dec 2021 17:08:23 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="1cadc526bfb859daa4447c158fee80fe";
logging-data="29503"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+SZnCPG2q5HPBRPd0xT+/Aaj/3XB5OUcU="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
Thunderbird/78.14.0
Cancel-Lock: sha1:IKcuoMQgpELuP6/gfos4amu/2Wo=
In-Reply-To: <j1oj05Fk7miU1@mid.individual.net>
Content-Language: en-US
 by: James Kuyper - Mon, 13 Dec 2021 17:08 UTC

On 12/13/21 4:44 AM, Bo Persson wrote:
> On 2021-12-13 at 06:48, Juha Nieminen wrote:
>> Paavo Helde <eesnimi@osa.pri.ee> wrote:
>>> No. Stack overflow is arguably the least specified behavior of them all.
>>> The stack size is extremely limited (few MB), compared to the RAM
>>> amounts current computers have (tens of GB). There is no
>>> standard-defined way to detect stack overflow, not to speak about
>>> handling it.
>>
>> That made me think: Why has neither the C nor the C++ standardization
>> committees ever thought of adding a standard library utility to get
>> the current amount of free stack space?

A key factor in that decision is the fact that neither the C nor the C++
standard ever talks about the stack space, a fact that allows either
language to be implemented on systems where the concept of "stack" is
meaningless.
On operating systems where the concept is meaningful, there often is a
way to conduct such a query. For instance, on Unix-like systems, there's
getrlimit(RLIMIT_STACK, &rlim).

,,,
>> (In fact, getting the amount of free (physical) RAM available to the
>> process could also be useful, for similar reasons. It could behave
>> in the same way: -1 if the operation is for some reason not supported,
>> else the amount of free RAM (not counting swap).)
>
> This would be of very limited use. The result of a call from one thread
> wouldn't be valid long, if the other threads allocate and free memory
> already while the result is returned.
>
> It is similar to filesystem::exists("path"). If you get a true or false
> back, how long is the result valid? Nanoseconds?

There's an important difference: as a matter of the policies you use for
managing a filesystem (rather than anything enforced by the operating
system), it is not only possible, but commonplace, to be certain that a
given file, if present, will remain in existence long enough to do
whatever it is you want to do with it.
That's not the case with the amount of free stack space.


devel / comp.lang.c / Re: Has "stack overflow" specified behavior?

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor