Quote:Original post by Necator
yes, but I guess the OS can introduce some reservations to that statement. Swapping out/in pages etc.
Paging has nothing to do with and is not a solution for running out of stack space.
Quote:Original post by Necator
yes, but I guess the OS can introduce some reservations to that statement. Swapping out/in pages etc.
Quote:Paging has nothing to do with and is not a solution for running out of stack space.
Quote:Original post by Necator
You have to remember that static variables are only stored once, global and local statics the same. I don't know exactly where it puts them, but since there is only one instance, the compiler can basically put them anywhere and hard-code their adresses.
Quote:
nd if stack memory is around a meg, aren't you in danger of of running out of stack space when using recursion(assuming whatever you're recursing is going to be doing a WHOLE bunch of recursing)?
void foo () { int i=0; while (1) foo ();}
void foo (int i) { i++; printf("up to %d\n",i); while (1) foo(i);}void main(){ int i = 0; foo(i); return;}
#include <iostream>void foo () { static int i=0; std::cout << i++ << std::endl; foo ();}int main () { foo (); return 0;}
struct WOAH_THISISBIGSTRUCT { int junk [50000];};void crazy (WOAH_THISISBIGSTRUCT wtibs){ static int i = 0; printf ("Up to %d\n", i++); crazy (wtibs);}