Re: [eigen] API change proposal |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
- To: eigen@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [eigen] API change proposal
- From: Hauke Heibel <hauke.heibel@xxxxxxxxxxxxxx>
- Date: Fri, 24 Jul 2009 08:21:28 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=xZszC/QYd5150CfSQZH2/TVQOYpK6A8s5XmKHWMTY14=; b=ojeg0j9wi3Cuo1m/naWCIudqsGpNtFq7xJVxfMkEV+XFxere6QaoJGk1NSxdfJBzCb 0j33iM4g5foYHKE2VIPq8/tgxHGFDNZ04FrXm6n7XEsMlZUJ/QqsJpE4JYmtQuQhwlPb rR7Vo3EltYNnq6k/iTjlGqgg9j+hAHSbacarg=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=BuNVPlbFSNg8+Hrd3bmoGanb5vZCThvPnn2jx01C40qEBTa+Ur9OsCJKcN8DBl0Oc5 wkVp02ISJ5z3g5dO0/sR43wImQ23CyWFtBr/O3axdxlLLfHg/ZL6ZTj5xUu5lHWbU2oW zoK0HjhdiQrUvoYbdGbTn8rWFIF2Nz4xTKC9o=
Hi again,
On Thu, Jul 23, 2009 at 4:31 PM, Kenneth Riddile <kfriddile@xxxxxxxxx> wrote:
> 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.
You can pass null, right? The function will simply return. What else
could happen? As long as the interface is not (!)
bool solve (const MatrixBase< OtherDerived > & b, ResultType*& result) const
it is clear that the method solve will not be creating the memory but
expects a readily usable matrix.
> If null is not a valid value, then the argument should be passed by reference.
True, in case you want to spare yourself from an additional line of code.
> one has to assume that a user/maintainer will look at the signature of the function when trying to understand its purpose.
I cannot agree more. :) Nonetheless, the documentation is quite decent...
So, my taste tells me to use references but technically speaking I am
still convinced that pointers are as valid and safe.
> Agreed...overloading should be preferred over default parameters.
Huuu, and this is a completely new discussion. ;)
- Hauke