Global variables seem to be reported multiple times by whos command

Mike Page Mike at Page-One.Waitrose.com
Thu Jul 1 17:23:16 CEST 2010


Hi,

When I use a global in a lower-level function, whos appears to report it
twice.  I don't know whether or not this is a bug.  If someone can advise, I
will add it to the Bugzilla if appropriate.


Example:

function []=test()
  global a;
  a = 1;
  disp (a);
  innerfunc ();
  disp (a);
endfunction

function []=innerfunc()
  whos -type *constant;
  global a;
  a = 2;
  whos -type *constant;
endfunction


-->test()

    1.
Name                     Type           Size           Bytes

a                        *constant      1 by 1         16
Name                     Type           Size           Bytes

a                        *constant      1 by 1         16
a                        *constant      1 by 1         16

    2.

The global works correctly, since the value at the outer level is changed,
but inside the inner function, whos reports it twice.  This number of
duplicates increments for every level of nesting.


Regards,
Mike.




More information about the users mailing list