octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: const mapper functions


From: John W. Eaton
Subject: Re: const mapper functions
Date: Tue, 8 Jan 2019 16:03:15 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1

On 1/8/19 3:24 PM, Rik wrote:
jwe,

Is there any reason not to make the function reference passed in to
do_rc_map constant?

ov-flt-re-mat.cc (738)
     V669     The 'fcn' argument is a non-constant reference. The analyzer
is unable to determine the position at which this argument is being
modified. It is possible that the function contains an error.

Line 737-738 of ov-flt-re-mat.cc is

static octave_value
do_rc_map (const FloatNDArray& a, FloatComplex (&fcn) (float))

The other *-re-mat.cc have the same question.  The function passed in is a
mapper like sin, cos, etc. and I can't imagine we would change it mid-stream.

I'm in favor of declaring any reference or pointer arguments and member functions const if we can. So yes, if you want to do i and have the time, please fix them.

I generally don't see a need for doing that for local values that are never modified after initialization, but I can also see the argument for that in some cases.

jwe




reply via email to

[Prev in Thread] Current Thread [Next in Thread]