Re: [eigen] API change proposal |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/eigen Archives
]
just my 5cent:
1. pointers are evil (and ugly) and should be avoided as much as possible
2. checking for NULL pointer is (a bit) costly.
3. Eigen2 is a high level library. pointers are lowest level.
(this is just my personal opinion)
Hauke Heibel wrote:
> 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
>
>
>