Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!uunet!lll-winken!ncis.tis.llnl.gov!helios.ee.lbl.gov!ux1.lbl.gov!beard From: beard@ux1.lbl.gov (Patrick C Beard) Newsgroups: comp.sys.mac.programmer Subject: Re: MPW C & registers Summary: Take Address of variables to force stack allocation. Message-ID: <4404@helios.ee.lbl.gov> Date: 7 Dec 89 21:10:25 GMT References: <1989Dec6.211341.762@ux1.cso.uiuc.edu> Sender: usenet@helios.ee.lbl.gov Reply-To: beard@ux1.lbl.gov (Patrick C Beard) Organization: Lawrence Berkeley Laboratory, Berkeley Lines: 28 X-Local-Date: 7 Dec 89 13:10:25 PST In article <1989Dec6.211341.762@ux1.cso.uiuc.edu> dorner@pequod.cso.uiuc.edu (Steve Dorner) writes: >SADE is capable of examining variables in previous stack frames, but not if >those variables are in registers. Therefore, I'd like to be able to tell the >MPW C compiler to not put variables in registers when I'm compiling test >versions of things. > I suppose a #pragma directive might be a nice way to do it as well, but you can keep variables out of registers by taking their addresses: i.e. statements like foo() { int x, y, z; &x, &y, &z; // keep these suckers out of registers. ... } will keep them on the stack. After looking in my MPW C manual, I also see that the keyword volatile can be used to keep variables on the stack. See the manual, pg. 48. ------------------------------------------------------------------------------- - Patrick Beard, Macintosh Programmer (beard@lbl.gov) - - Berkeley Systems, Inc. "..............Good day!" - Paul Harvey - -------------------------------------------------------------------------------