Re: About stack size

From: Thomas Matthews (Thomas_MatthewsSpitsOnSpamBots_at_sbcglobal.net)
Date: 09/09/04


Date: Thu, 09 Sep 2004 19:47:01 GMT

Sam Sungshik Kong wrote:
> Hello, group!
>
> I wonder how the stack size is set (or determined by compilers) and if it
> can be resized during run-time.
There is no requirement that programs have stacks. The use of
stacks is compiler dependent.

If a compiler uses a stack, the stack size depends on the memory
of the platform. Some compilers allow one to set the stack
size as a parameter to the compiler.

> I heard that it's dynamic.
> What does it mean?
Funny, that's my question too.
This could mean that a stack can grow or shrink during
runtime as opposed to an array.

> Dynamic during compile-time or run-time?
Your program doesn't have a stack during compile time.
If a compiler uses a stack during the translation of
a program, that would be during compile-time and probably
not adjustable by the user.

Stacks, by their design, are dynamic during runtime.
Many stacks have a maximum size that they can grow
to.

> The stack area can't be divided, right?
What do you mean by divided? Please give example.

> Is it always before the start point of heap?
No. The stack is wherever the compiler implementor
decided to put it.

Is the use of a stack important to you?
Is the location of the stack or heap important to
you?

In most programs, there is no concern over a stack
or a heap; especially where they are located.

-- 
Thomas Matthews
C++ newsgroup welcome message:
          http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq:   http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
          http://www.comeaucomputing.com/learn/faq/
Other sites:
     http://www.josuttis.com  -- C++ STL Library book


Relevant Pages

  • Re: Is MSDN wrong? or I made a mistake? about static member function
    ... the heap" or some such reference. ... shouldn't we have a uniform notation? ... You can tell a heap object from a stack object by ... the result of trying to build a compiler on a tiny computer by someone who wasn't a very ...
    (microsoft.public.vc.mfc)
  • Re: Interview Questions
    ... This depends on the platform and maybe the Operating System. ... implementation to have a stack or heap. ... C++ Faq: http://www.parashift.com/c++-faq-lite C Faq: http://www.eskimo.com/~scs/c-faq/top.html alt.comp.lang.learn.c-c++ faq: ...
    (comp.lang.cpp)
  • Re: GNAT GPL for Mac OSX stack checking problem
    ... The compiler and GPS seem to work, it is the generated test driver ... documentation to increase it under macos, but traditionally, the stack ... Linux GNAT uses the heap, Rational Apex uses the heap, the VADs Ada83 ... The above test driver would not have run on older Linux releases using ...
    (comp.lang.ada)
  • Re: Value Types and Reference Types
    ... There is a stack and a heap. ... The compiler basically has a list of types that are ... If you do int x and then object y = x. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Do buffers always start with the lowest memory address being the first element?
    ... > The C standard does not assume a downward-growing stack, ... > an upward-growing stack. ... C allows but does not require that the array produced ... > machine depends on both the C compiler and the machine. ...
    (comp.lang.c)