Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!cernvax!chx400!ethz!neptune!iiic.ethz.ch!mneerach From: mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) Newsgroups: comp.lang.c Subject: Re: Novice question. Message-ID: <14624@neptune.inf.ethz.ch> Date: 14 Nov 90 09:56:11 GMT References: <1990Oct31.014132.2400@agate.berkeley.edu> <336@brat.UUCP> <3838@vela.acs.oakland.edu> Sender: news@neptune.inf.ethz.ch Reply-To: mneerach@iiic.ethz.ch (Matthias Ulrich Neeracher) Organization: Departement Informatik, ETH, Zurich Lines: 20 In article <3838@vela.acs.oakland.edu> jmwojtal@vela.acs.oakland.edu (Wojo) writes: >What exactly are the reasons "register" and "extrn" are used to declare >values. I see register alot in some of the programs and I don't know why >they do it. Is it just good practice or what. "extern" essentially tells the compiler that this variable is defined elsewhere. "register" is a hint to the compiler that this variable will be used a lot and that the compiler should try to keep it in a processor register. This hint was introduced in a time when programmers were smart and compilers were stupid. Today, the opposite is true :-), so some compilers ignore "register" hints completely and allocate registers as they see fit. 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_