Usenet comp.os.linux.alpha (1997-2013)
 help / color / mirror / Atom feed
From: Chris <quattro_net@dtn.ntl.com>
Subject: Re: why only 6 params passed in registers?
Date: 2000/01/14	[thread overview]
Message-ID: <387F4F73.F7B9F1DA@dtn.ntl.com> (raw)
In-Reply-To: 85n8st$kmm$1@nserve1.acs.ucalgary.ca

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



  reply	other threads:[~2000-01-14  5:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-01-12  5:00 why only 6 params passed in registers? david_morse
2000-01-12  5:00 ` Martin Sinot
2000-01-12  5:00   ` Serguei Patchkovskii
2000-01-14  5:00     ` Chris
2000-01-14  5:00       ` Serguei Patchkovskii
2000-01-14  5:00         ` Chris [this message]
2000-01-15  5:00       ` Greg Lindahl
2000-01-15  5:00         ` Chris
2000-01-15  5:00           ` Serguei Patchkovskii
2000-01-16  5:00             ` Chris
2000-01-16  5:00               ` Serguei Patchkovskii
2000-01-12  5:00 ` Alex Rhomberg
2000-01-14  5:00 ` Steven Hobbs
2000-01-14  5:00   ` Martin Sinot
2000-01-14  5:00     ` Steven Hobbs
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox