Re: [eigen] API change proposal

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Agreed...overloading should be preferred over default parameters.

--- On Thu, 7/23/09, Tim Hutt <tdhutt@xxxxxxxxx> wrote:

From: Tim Hutt <tdhutt@xxxxxxxxx>
Subject: Re: [eigen] API change proposal
To: eigen@xxxxxxxxxxxxxxxxxxx
Date: Thursday, July 23, 2009, 9:39 AM

2009/7/23 Kenneth Riddile <kfriddile@xxxxxxxxx>:
> I'll chime in here...When I see a function that takes any type of pointer
> (const/non-const) as a parameter, this signals to me that null is a valid
> value to pass to the function..  If null is not a valid value, then the
> argument should be passed by reference.  As far as whether or not it's
> obvious from the call site whether the argument may be modified, one has to
> assume that a user/maintainer will look at the signature of the function
> when trying to understand its purpose.  A function's signature is its public
> interface after all.

I concur. The only place pointers should be used is where the value
might be NULL. However this doesn't include cases like this:

int atoi(int x, bool* error = NULL);

In that case I think it would be better to have to have two functions:

int atoi(int x);
int atoi(int x, bool& error);




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/