[openbox] argument lists in functions

Mikael Magnusson mangosoft at comhem.se
Tue Mar 16 00:22:16 EST 2004


On Tue, 16 Mar 2004, Mikael Magnusson wrote:

> On Mon, 15 Mar 2004, John Russell wrote:
> 
> > Can someone who knows some more about the OB code than I do answer this
> > question.  What is the point of having argment lists like this:
> > 
> > void place_client(ObClient *client, gint *x, gint *y)
> > 
> > where *x and *y are merely pointers to client->area.x and
> > client->area.y.  In functions such as this, x and y are modified inside
> > the functions to modify the client position or whatever it is the
> > function is meant to do.  
> > 
> > Why not _just_ pass in a pointer to the client?  Why not say
> > 
> > void place_client(ObClient *client)
> > {
> > 	and then directly modify the position numbers there.  
> > 
> > John
> > 	
> 
> dereferencing one pointer is faster than dereferencing two pointers (ie 
> client and then x or y)

actually, i really have no idea, there are tons of semicrazy things in the 
ob code like only checking if things are bigger than some max value but 
not if they are < 0, and it works anyway and as it turns out, the 
variables were unsigned.

--
Mikael Magnusson



More information about the openbox mailing list