Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!cernvax!chx400!chx400!bernina!neptune!iiic.ethz.ch!mneerach From: mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) Newsgroups: comp.sys.mac.programmer Subject: Re: Can I count on any alignment from NewHandle or NewPtr? Message-ID: <27360@neptune.inf.ethz.ch> Date: 11 Mar 91 09:40:02 GMT References: <3588@ux.acs.umn.edu> Sender: news@neptune.inf.ethz.ch Reply-To: mneerach@iiic.ethz.ch Organization: Departement Informatik, ETH, Zurich Lines: 21 In article <3588@ux.acs.umn.edu>, dhoyt@vx.acs.umn.edu (DAVID HOYT) writes: >''' > Can I count on any sort of alignment from the mac memory manager? Or do I >have to roll my own by allocating n-1 more bytes than I really need? > Also, is there any guarentee on stack alignment? I'm trying to build a >garbage collector for MacApp/C++ and it would be faster if I could rely on >alignment. You can count on word alignment, but not longword alignment both for heap blocks and stack values. There are certain compilers which try to keep the stack always longword aligned - one of them is described in a paper by Michael Franz in a recent issue of SIGPLAN Notices. It *might be* that on newer machines, heap blocks are longword aligned, but I know from painful experience that at least on a Plus, this is not always true. Matthias -- Matthias Neeracher mneerach@iiic.ethz.ch "These days, though, you have to be pretty technical before you can even aspire to crudeness." -- William Gibson, _Johnny Mnemonic_