Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c++ Subject: Re: Has "stack overflow" specified behavior? Date: Tue, 14 Dec 2021 10:52:35 -0800 Organization: None to speak of Lines: 36 Message-ID: <87y24n81e4.fsf@nosuchdomain.example.com> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: reader02.eternal-september.org; posting-host="abb7162027a59d3701de80734b2d80ee"; logging-data="7470"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19SUVMaHgQE44PTkfXdJdYu" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) Cancel-Lock: sha1:XtUQbrC6meve0VbIeSp27Yxncb0= sha1:Xha7M6GHPl2cj68blSucWtEU3Yw= Xref: csiph.com comp.lang.c++:82639 David Brown writes: > On 14/12/2021 08:33, Bonita Montero wrote: >> Am 13.12.2021 um 18:13 schrieb James Kuyper: >> >>> 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. >> >> Every language that allows recursions has a stack. >> And both C and C++ allow recursions. > > As so often happens, your views are coloured by your "all the world is > an x86 running Windows" experience. > > Certainly stacks are the usual way to implement such languages. > > But they are not the only way - AFAIK there have been computers that > used a linked list of local data frames rather than a stack. [...] There are (at least) two distinct meanings of "stack". One is a contiguous region of memory used to allocate memory for function calls, growing in one direction in the address space and shrinking in the other. Most C implementations do use a "stack" in this sense, but the standard doesn't specify it. Another is any data structure that supports LIFO allocation and deallocation. *Every* C implementation has this kind of stack to support the semantics of function calls, however it's implemented. -- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com Working, but not speaking, for Philips void Void(void) { Void(); } /* The recursive call of the void */