bugGNU Octave - Bugs: bug #38261, fdisp not called for objects...


bug #38261: fdisp not called for objects stored in structs or cell arrays

Submitted by:  John W. Eaton <jwe>
Submitted on:  Tue 05 Feb 2013 04:20:24 AM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  jwe Open/Closed:  Closed
Release:  dev Operating System:  Any

Add a New Comment (Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Tue 15 Aug 2017 05:08:30 PM UTC, comment #4: 

Yes, this bug is now resolved on the default branch.

The original example is now affected by bug #50756, where only the name of the class is displayed when it is in a cell array or a struct.

Mike Miller <mtmiller>
Project Administrator
Tue 15 Aug 2017 06:50:19 AM UTC, comment #3: 

Checking with hg id 23915:adf580507691 and this seems to work now.  Could someone else verify that and close this report?

Rik <rik5>
Project Administrator
Sat 19 Nov 2016 11:08:36 PM UTC, comment #2: 

This bug is still present in Octave 4.2.0.

(The resulting file "foo.out" from comment #0 still has no string "foo" in it.)

Hartmut <hardy>
Fri 08 Feb 2013 06:26:31 PM UTC, comment #1: 

I just verified that direct overloads of disp() or fdisp() are called by the interpreter so that part seems to be working correctly.

It seems the issue is really in the C++ code that has to loop over a data structure and display each element.  That routine, which I haven't looked for in the code yet, must just be calling the ordinary print on each element in the data structure.

Rik <rik5>
Project Administrator
Tue 05 Feb 2013 04:20:24 AM UTC, original submission:  

Given the following simple (old-style) class definition and overloaded methods:

% @foo/foo.m:
function obj = foo ()
  obj = class (struct ('x', 13), 'foo');

% @foo/display.m:
function display (obj)
  disp (obj.x);

% @foo/fdisp.m:
function fdisp (fid, obj)
  fdisp (fid, obj.x);

(For ease of duplicating the problem, a tar file with these functions is attached).

fdisp is not called as one might expect when an object of class foo is stored in a struct or cell array:

octave:1> obj = foo
octave:2> fid = fopen ('foo.out', 'w');
octave:3> fdisp (fid, {obj})
octave:4> fdisp (fid, struct ('x', obj));
octave:5> fclose (fid);

This bug is why we are currently seeing output from the tests that were recently added for concatenation of class objects with built-in types.

Further, I suspect that display and disp are not called by the interpreter as described in the Matlab documentation.

John W. Eaton <jwe>
Project Administrator


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #27390:  @foo.tar added by jwe (10KiB - application/x-tar)


Depends on the following items: None found

   bug dependencies.


Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by hardy (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by jwe (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-15 mtmiller StatusWorks For Me => Fixed
        Open/ClosedOpen => Closed
    2017-08-15 rik5 StatusNone => Works For Me
    2013-02-08 rik5 Dependencies- => bugs #38286 is dependent
    2013-02-05 jwe Attached File- => Added @foo.tar, #27390

    Back to the top

    Powered by Savane 3.6