From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,f6dda81e7269c676 X-Google-Attributes: gid111c93,public From: Chris Subject: Re: why only 6 params passed in registers? Date: 2000/01/14 Message-ID: <387F4F73.F7B9F1DA@dtn.ntl.com>#1/1 X-Deja-AN: 572620322 Content-Transfer-Encoding: 7bit References: <85hhsi$lkj$1@nnrp1.deja.com> <85hs78$3a7$1@news.telekabel.nl> <85iba2$fcs$2@nserve1.acs.ucalgary.ca> <387EEFA6.3CD3F398@dtn.ntl.com> <85n8st$kmm$1@nserve1.acs.ucalgary.ca> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@net.ntl.com X-Trace: nclient3-gui.server.dtn.ntl.com 947867676 19156 212.250.69.31 (14 Jan 2000 16:34:36 GMT) Organization: Man Mime-Version: 1.0 NNTP-Posting-Date: 14 Jan 2000 16:34:36 GMT Newsgroups: comp.os.linux.alpha Serguei Patchkovskii wrote: > > Chris (quattro_net@dtn.ntl.com) wrote: > : You would make the code much more efficient and faster by writing the > : code to put all the args in a structure, then passing a pointer to it. > : Voila, only a single register needed and you only have to add an element > : to the structure, not change the function declaration, if you need to > : add more args later. > > You win nothing doing this. Wrong. If you have loads of args, they all have to be saved in registers or on the stack for every call. This takes time and wastes resources. If you are writing recursive code it's even worse. > you'll either end up passing huge structures unnecesarily, I did say pass a _pointer_ to it. A single arg irrespective of the number of underlying function call args. > end up stuffing your parameters into Yet Another Meaningless Struct > all the time - take your pick. It's programming style. If you organise your data efficiently, you'll find structures become the natural place to put it. > > Well, welcome to the real world. > For me it's a case of trying to develop good programming habits - thinking about data organisation before bashing out the code ;-). Just $0.02, YMMV... Rgrds, Chris