Re: Static Variables
- From: Flash Gordon <spam@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 20 Feb 2007 19:23:47 +0000
Richard Heathfield wrote, On 20/02/07 09:57:
akhil.misra@xxxxxxxxx said:
where does a static variable inside a function get stored??
In random access memory, or "RAM" (or, if it's const, it might get put into read-only memory, or "ROM").
You mean my implementation using pairs of goldfish to store each bit (one a second the goldfish that knows the current value tells the other goldfish to "refresh" the bit and stop it from being forgotten) is not a conforming implementation? Damn.
<snip>
Local variable goes on Stack...
Assuming you mean automatic objects, they're stored in RAM, unless they're const, in which case they might go into ROM. They might be incorporated into some kind of a stack structure, or they might not. It's up to the implementation.
Or they might go in to non-random-access registers, or might be completely eliminated by the optimiser.
but how does static variable takes place in memory??
It goes into RAM (or, if it's const, it might go into ROM). The precise details depend on the implementation.
I do, of course, agree with the general thrust of your post :-)
--
Flash Gordon
.
- Follow-Ups:
- Re: Static Variables
- From: Keith Thompson
- Re: Static Variables
- From: matevzb
- Re: Static Variables
- References:
- Static Variables
- From: akhil.misra@xxxxxxxxx
- Re: Static Variables
- From: Richard Heathfield
- Static Variables
- Prev by Date: Re: Why there aren't any female regulars in c.l.c?
- Next by Date: Re: Returning an array of strings in C
- Previous by thread: Re: Static Variables
- Next by thread: Re: Static Variables
- Index(es):
Relevant Pages
|