Pointers to global and stack variables

"shrey" <shreyas76@gmail.com>
26 Nov 2005 00:21:36 -0500

          From comp.compilers

Related articles
Pointers to global and stack variables shreyas76@gmail.com (shrey) (2005-11-26)
Re: Pointers to global and stack variables henry@spsystems.net (2005-11-27)
Re: Pointers to global and stack variables 148f3wg02@sneakemail.com (Karsten Nyblad) (2005-11-29)
Re: Pointers to global and stack variables alexc@TheWorld.com (Alex Colvin) (2005-11-30)
| List of all articles for this month |

From: "shrey" <shreyas76@gmail.com>
Newsgroups: comp.compilers
Date: 26 Nov 2005 00:21:36 -0500
Organization: http://groups.google.com
Keywords: question, comment
Posted-Date: 26 Nov 2005 00:21:36 EST

        I am trying to understand what might be a few major and general
reasons why programmers might have pointers to global and stack data as
compared to pointers to heap which are essential to building data
structures. Based on that I want to find programs with such pointers.
Some reasons general reasons I can think of are making pointers point
to a array based on runtime conditions, writing obfuscated but compact
code , better code generation in DSP processors etc. Can any one
suggest me any other reasons ?

[The short answer is "because that's what their programs do". There might be
a linked list with dynamically allocated entries but a static head. There
might be some sort of symbol table that has various sorts of subfields, some
of which could be in short lived stack variables.

If the question is whether you could write a language which decreed that pointers
can only point to heap storage, sure, it's been done, but at some loss in
expressive flexibility. -John]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.