was studying the earlier posts regarding the stack and the standards
associated with it which I must say are none. I mean, In the previous
posts , it has been remarkedd that there's no concept of stack in C. I
think that stack / heap allocation is OS's functionality and NOT a
language's duty to be performed.
So What i conclude is that C doesnot support stacks BUT MOST of the
OSs do ... Is it ?
C does not provide any stack type; but, it is possible to create a stack
abstraction using a number of data structures and function wrappers.
Some OSes (mostly mainframe based) offer system stack and/or queue
implementations that that user programs can use to store data and which
persists between processes. These are often used as a form of IPC
between different routines or processes. The C standard does not offer
any access to these but a given implementation designed for a such a
system might as languages for these systems commonly have the ability
to access these stacks/queues. There are services/daemons available
from operating systems which do not provide these built in structures.
For these systems, there will likely be an API available providing
functions by which C can access these services.
The stack as often referenced in C, as opposed to a stack or the system
stack commonly provided on mainframe operating systems, is a common but
not standardized method for implementing function calls available on
many hardware architectures (On some embedded systems this is separate
memory entirely. More conventional systems implement hardware stacks
in the main memory using a stack pointer). If these are available from
the given architectural/operating system combination, a C compiler *may*
choose to implement its function calls using this available structure.
This is quite common, as it simplifies the code generation, as the
compiler does not need to implement its own data structures and routines
for handling function context. There are reasons that a compiler might
choose not to use the hardware stack, even if it is available, such
as being able to have an arbitrary length stack, which is useful for
deeply recursive algorithms, or to help minimize the damage of stack
based buffer overflow attacks.