octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #57865] Builtin is not calling the built in ve


From: anonymous
Subject: [Octave-bug-tracker] [bug #57865] Builtin is not calling the built in version
Date: Thu, 20 Feb 2020 02:21:26 -0500 (EST)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:73.0) Gecko/20100101 Firefox/73.0

URL:
  <https://savannah.gnu.org/bugs/?57865>

                 Summary: Builtin is not calling the built in version
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Thu 20 Feb 2020 07:21:24 AM UTC
                Category: None
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: 5.2.0
         Discussion Lock: Any
        Operating System: GNU/Linux

    _______________________________________________________

Details:

I'm using hacks to recognize the 'like' keyword. It works for zeros but fails
for cast. For some reason, the last line is not calling the builtin version of
cast but keeps calling this hack version.

E.g. 

>> cast(0,'like',1)
error: max_recursion_depth exceeded
error: called from
    cast at line 20 column 3



function x = cast(varargin)

% search for 'like' or any char (e.g. 'single')
for k = 1:nargin
    if isequal(varargin{k},'like')
        if k==1 || k==nargin
            error('invalid usage of ''like'' keyword.');
        end
        varargin{k} = class(varargin{k+1});
    end
    if ischar(varargin{k})
        break;
    end
end

% fix octave bug (k undefined if nargin==0)
if nargin==0; k = []; end

% pass vararin to builtin function
x = builtin('cast',varargin{1:k});





    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57865>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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