Re: Where is a static variable stored?



In article <1152901674.865652.57980@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Jack <junw2000@xxxxxxxxx> wrote:

I think for a static variable defined out of any functions, i.e., it is
a global variable, it is located in the data segment of the program.
How about a static variable defined within a function? it is a local
variable. Is it located at the stack?

And if the other more detailed answers are not sufficiently clear
to you:

NO. I have never encountered an implementation that stored
a static variable in the stack. Doing so would not be impossible
(provided the implementation has a stack at all), but it is enough
extra work to be unlikely to be the chosen mechanism; such an
implementation would, for example, have the side effect of being
unable to build dynamically loadable libraries.
--
Okay, buzzwords only. Two syllables, tops. -- Laurie Anderson
.



Relevant Pages

  • Re: 200 horse on ftp tonight
    ... > 16 Paid, I finished 17th, lol. ... > Jack on 6th street for about 80% of my stack. ... mouth, ...
    (rec.gambling.poker)
  • Re: What Is What Is This Shit?
    ... Stack 'em up with The Band and let the night ... Jersey Jack ... Hey, I didn't say that those three were the best for that purpose, only ...
    (rec.music.dylan)
  • Why I hate Omaha
    ... I jam and a ... huge stack calls and the flop comes: ... I knew the villain had a jack. ...
    (rec.gambling.poker)
  • Re: const &
    ... Jack ... param can not be modified on the stack ... Prev by Date: ...
    (microsoft.public.vc.language)
  • Re: [PATCH RFC/RFB] x86_64, i386: interrupt dispatch changes
    ... | that instruction sequence. ... the cost is 6 cycles instead of 1 cycles. ... save the current data segment registers (the stack segment and code ... I kept the information that is saved on the stack exactly the ...
    (Linux-Kernel)