Newsgroups: comp.sys.amiga.programmer Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!elroy.jpl.nasa.gov!decwrl!pa.dec.com!bacchus!mwm From: mwm@pa.dec.com (Mike (My Watch Has Windows) Meyer) Subject: Re: Any restrictions with making programs PURE? In-Reply-To: crazyrat@disk.uucp's message of 19 Apr 91 23:11:19 GMT Message-ID: Sender: news@pa.dec.com (News) Organization: Missionaria Phonibalonica References: <1991Apr12.203658.11790@unlinfo.unl.edu> <1991Apr19.231119.6428@disk.uucp> Date: 23 Apr 91 12:41:14 Lines: 27 In article <1991Apr19.231119.6428@disk.uucp> crazyrat@disk.uucp (@jap) writes: In article <1991Apr12.203658.11790@unlinfo.unl.edu>, 231b3678@fergvax.unl.edu (Phil Dietz) writes: > Are there any restrictions with making 'C' programs PURE? Is it just a matter > of linking it with cres.o? From my experience, the only way a program can be pure is to make the code re-entrant. That is, all variable space has been DYNAMICALLY allocated. This is correct. I don't normally do re-entrant routines in C, but in Assembler. It's much easier.. This isn't. Linking with cres.o is enough to get the C compiler to dynamically allocate your statics. That takes care of that. If you need to refer to an absolute object (Custom comes to mind) you'll have to declare it far. I vaguelly recall some compilation modes that don't work with cres.o (-b0?), but don't have the details in handy.