octave-maintainers
[Top][All Lists]
Advanced

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

Re: input validation in C++ internal functions


From: Andreas Weber
Subject: Re: input validation in C++ internal functions
Date: Fri, 23 May 2014 11:10:49 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.5.0

Am 22.05.2014 12:41, schrieb Juan Pablo Carbajal:
> On Thu, May 22, 2014 at 10:10 AM, Andreas Weber <address@hidden> wrote:
>> Am 05.05.2014 19:24, schrieb Jordi GutiƩrrez Hermoso:
>>> On Mon, 2014-05-05 at 16:39 +0100, Michael D. Godfrey wrote:
>>>> On 05/05/2014 07:47 AM, Andreas Weber wrote:
>>>>> In my humble optinion no function should segfault when accessible from
>>>>> the octave interpreter.
>>>> I am pretty sure that Jordi agrees with this, and it s a long-standing
>>>> principle that Octave should never seg fault.
>>> Yeah, it's a bug, although I consider it a minor one, since it's in
>>> internal functions.
>>>
>>> My complaint at the time was that almost none of the internal C++
>>> functions do any argument-checking. I'm not against this sort of
>>> patch, but I am against cluttering every internal C++ function with
>>> argument-checking boilerplate code. Andy's patch in question at the
>>> moment looks reasonable to me, but it's a stopgap around a larger
>>> problem.
>> Pushed to stable
>> http://hg.savannah.gnu.org/hgweb/octave/rev/5e99fd6ea758 after
>> discussion in IRC. -- Andy
>>
>>
> Is it possible to add a error_id in the error message?
> I suggest
>
> error ("Octave:invalid-input-arg", "__calc_dimensions__: expecting
> graphics handle as only argument");
>
> ids and their description can be retrieved using error_ids in the  octave 
> prompt

Dear Juan Pablo,
I guess this should be "error_with_id
("Octave:invalid-input-arg",......", right?

When grepping through libinterp/corefcn/ I see than only a few files
uses error_with_id (most in cellfun.cc). My intial question was intended
to figure out how we should handle input-checking in internal C++ code.

I understand Jordi that he doesn't want to clutter internal functions
with argument checking, nevertheless to my understanding they should
never segfault. I guess a better way would be to do and index checking
in octave_value_list so that args() out of bounds raise and error but
this is just a wild guess from me.

To your question: Of course I can add  error_id but in my optinion is,
that this is controversial to the previously "do only the absolutely
necessary input checks" conclusion and I don't want to start another
controversy. I hope this is okay for you. -- Andy





reply via email to

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