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

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

[Octave-bug-tracker] [bug #51997] Missing documentation of return value


From: Pantxo Diribarne
Subject: [Octave-bug-tracker] [bug #51997] Missing documentation of return value of warning()
Date: Wed, 13 Sep 2017 11:37:58 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #2, bug #51997 (project octave):

I tried to rewrite the documentation (see attached patch) but then found that
Octave behaved strangely, or at least not as ML says it behaves in the
documentation, with regard to output warnstruct.

So I have to requests:
* Can someone take a look at the modified doc and tell me if it is clearer or
worse ?
* Can someone run the following tests  in Matlab to determine how Octave
should strive to behave?


% Does ML report the special 'all' identifier in warnstruct
s = warning ();
any (strcmp ({s.identifier}, 'all')) %true in Octave

% Does ML return a warnstruct when setting the state all warnings
% and if so is it the previous state
try
  s2 = warning ('off');
  if (~ isequal (s, s2))
    disp ('Warnstruct returned when setting all different from previous all')
    disp (s2)
  else %Octave has this behavior
    disp ('Warnstruct returned when setting all')
  end
  warning (s)
catch
  error ('No warnstruct returned when setting all and equal to previous all')
  warning (s)
end

% Does ML return a warnstruct when setting the state of a given 
% warning and if so is it all warnings or only the one related to id
try
  loglog (0:10) % I expect some warning here
  [~, id] = lastwarn ();
  s2 = warning ('off', id);
  if (~ isequal (s, s2))
    disp ('Warnstruct returned when setting id different from previous all')
    disp (s2)
  else %Octave has this behavior
    disp ('Warnstruct returned when setting id and equal to previous all')
  end
  warning (s)
catch
  error ('No warnstruct returned when setting id')
  warning (s)
end



(file #41794)
    _______________________________________________________

Additional Item Attachment:

File name: warndoc.patch                  Size:6 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51997>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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