Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!rpi!sci.ccny.cuny.edu!phri!cmcl2!kramden.acf.nyu.edu!brnstnd From: brnstnd@kramden.acf.nyu.edu (Dan Bernstein) Newsgroups: comp.lang.c Subject: Re: May too many register variables hurt? (was Re: Novice question.) Message-ID: <9733:Nov2722:02:3090@kramden.acf.nyu.edu> Date: 27 Nov 90 22:02:30 GMT References: <967@mwtech.UUCP> <1990Nov21.221908.19871@cbnewsm.att.com> <976@mwtech.UUCP> Organization: IR Lines: 16 In article <976@mwtech.UUCP> martin@mwtech.UUCP (Martin Weitzel) writes: > In short, I tried to warn the reader that everything which exceeds two > register declarations in the outmost block of a function *could* result in > code that performed worse than with fewer declarations (hence the subject). Sure. And it *could* also result in much better code. What most of us are saying is that in practice extra register declarations help much more than they hurt. In typical programs, some variables are used quite a lot, and they should be declared register. Some variables are rarely used, and they shouldn't be declared register. It's better to err on the side of extra register declarations than to pessimize your code in the common case. Past that, who cares? The language doesn't provide better mechanisms for asserting variable use, so you won't be able to outguess the compiler in very many cases. ---Dan