Xref: utzoo comp.lang.c:30494 gnu.gcc:1798 Newsgroups: comp.lang.c,gnu.gcc Path: utzoo!henry From: henry@zoo.toronto.edu (Henry Spencer) Subject: Re: Local Variable Storage Scope Message-ID: <1990Jul24.151530.20772@zoo.toronto.edu> Organization: U of Toronto Zoology References: <1990Jul23.230418.15169@uunet!unhd> Date: Tue, 24 Jul 90 15:15:30 GMT In article <1990Jul23.230418.15169@uunet!unhd> al@uunet!unhd (Anthony Lapadula) writes: > { int local1[100]; /* some code goes here */ } > { int local2[100]; /* more code goes here */ } > >Is the compiler allowed to allocate just enough space for only >one of the local arrays? That is, can ``local1'' and ``local2'' >share the same spot on the run-time stack? Certainly. local1 exists only inside the first block, local2 exists only inside the second, so it is perfectly legitimate to re-use the storage that used to hold local1 for local2. Mind you, there is no promise that this will be done. -- NFS: all the nice semantics of MSDOS, | Henry Spencer at U of Toronto Zoology and its performance and security too. | henry@zoo.toronto.edu utzoo!henry