From: Erik Max Francis Newsgroups: comp.os.msdos.djgpp Subject: Re: Fast random number generator Date: Tue, 15 Jul 1997 01:13:53 -0700 Organization: Alcyone Systems Lines: 27 Message-ID: <33CB3141.CA7B5B6@alcyone.com> References: <33C91424 DOT 7615 AT wanadoo DOT fr> <01bc90cc$81dffec0$d1488cd0 AT scochran DOT SHOALSnet DOT com> NNTP-Posting-Host: newton.alcyone.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk scochran AT shoalsnet DOT com wrote: > void randomxy(int &x, int &y) // using refrences speeds it up by using > the > actual varibles Using references are no faster than using pointers, as they are functionally equivalent, and only represent a stylistic difference. And, if I may interject a stylistic suggestion here, using references in this way is in general not so hot of an idea. References are useful for very specific circumstances; this is not one of them. Wherever possible, one should stick with C's pass-by-value mandate, thus making it clear to a caller what will be changed and what will not. Speaking from experience, when one uses too many non-const references just for the sake of _using_ them, it muddies the whole issue of, when calling a function, what will get affected outside of the calling function and what will not. This can lead to a big headache. -- Erik Max Francis, &tSftDotIotE / email / max AT alcyone DOT com Alcyone Systems / web / http://www.alcyone.com/max/ San Jose, California, United States / icbm / 37 20 07 N 121 53 38 W \ "All the gods are dead / except the god of war." / Eldridge Cleaver