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

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

[Octave-bug-tracker] [bug #55810] sizeof() returns 0 for classdef object


From: Andrew Janke
Subject: [Octave-bug-tracker] [bug #55810] sizeof() returns 0 for classdef objects
Date: Sat, 2 Mar 2019 08:30:38 -0500 (EST)
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36

Follow-up Comment #1, bug #55810 (project octave):

Oh, whoops: looks like `whos` does not respect `sizeof` overrides. If I add a
custom sizeof to MyDumbClass:


classdef MyDumbClass

  properties
    data
  endproperties

  methods
    function this = MyDumbClass (data)
      this.data = data;
    endfunction
    
    function out = sizeof (this)
      out = sizeof (this.data);
    endfunction
  endmethods

endclassdef



Then sizeof() reports a big number, but whos() still shows 0 bytes. 


>> sizeof(x)
ans =  8000000
>> whos
Variables in the current scope:

   Attr Name        Size                     Bytes  Class
   ==== ====        ====                     =====  =====
        ans         1x1                          8  double
        x           1x1                          0  MyDumbClass

Total is 2 elements using 8 bytes



Maybe whos() should delegate to sizeof(), respecting overrides?

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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