www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/09/14/18:41:22

Date: Mon, 14 Sep 92 17:09:55 CDT
From: "George Jetson" <pynq AT midway DOT uchicago DOT edu>
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Is there a limit on the size of automatic variables?

I.e., how big is the stack?

I wrote the following program:

	main()
	{
		int fung;

	loop:
		printf("Enter value for fung: ");
		scanf("%d",&fung);
		printf("fung = %d\n",fung);
		{
		struct foo {
			char *x[fung];
			int y[fung];
			} zeta;
		printf("sizeof(struct foo) = %d\n",sizeof(struct foo));
		printf("sizeof(zeta) = %d\n",sizeof(zeta));
		}
	goto loop;
	}

And merrily entered values for fung.  I tried -1 and it said the sizeof
was very big indeed.  Now, this is all just screwing around, but I do
wonder just how much stack one is allowed to allocate...

And, what will happen if it is too big?
(Can anything bad happen?)

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019