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: Array allocated on stack or heap Date: Sun, 19 Mar 2017 16:15:33 -0700 Organization: None to speak of Lines: 44 Message-ID: References: <01036705-6fe5-4262-8fd0-86eb5ef5f449@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit Injection-Info: mx02.eternal-september.org; posting-host="1d8377b301600956704a141c58c5388f"; logging-data="6477"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+AmgircKAyVpQ3g/nzzzVO" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:5SXOKcE8DI6bMpemOjsjVT+2dBY= sha1:PqCZ4PHcTK6MsLQzVzTddY/uL3s= Xref: csiph.com comp.lang.c:106523 jacobnavia writes: > Le 19/03/2017 à 23:16, BartC a écrit : [Sorry if the accented characters show up in correctly. jacob's article has charset=utf-8, but for some reason my newsreader still doesn't handle the accented characters correctly. For example an 'e' with an accute accent shows up as \303\251, though can still enter é correctly. It is a puzzlement.] [...] > Why this eternal discussion? Yes, why? > Again: > > In most CPUs there is a stack pointer and a hardware stack, that is > mapped by the language to stacked function scopes. (Quibble: lifetimes, not scopes. Scope refers only to compile-time visibility of identifiers, not to memory allocation or lifetime.) Yes, most, not all. The standard specifies that objects with automatic storage duration are allocated in a stack-like last-in first-out manner. The most common, but not universal, way to implement that is via a hardware stack, where allocation takes place within a contiguous region of memory typically managed by a "stack pointer". The standard does not specify this implementation. Other implementations are possible, but rare. I think everyone who has discussed this here understands all that. What exactly are you still arguing about? Do you object to acknowledging that implementations other than a contiguous hardware stack are both possible and actually used in the real world? If so, why? Do you understand that the word "stack" has (at least) two distinct meanings, and that some of us are simply trying to keep that distinction clear? -- 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"