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

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

[Octave-bug-tracker] [bug #34967] Bad behavior of structures with an emp


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #34967] Bad behavior of structures with an empty cell
Date: Fri, 02 Dec 2011 11:27:02 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20100101 Firefox/8.0 Iceweasel/8.0

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

The expression


struct ("name", {})


creates a 0x0 structure array with a field called "name".  It doesn't have any
elements, so it's size is 0x0.  So your first example is the result I would
expect.

Your second example shows a bug.  The behavior is different in the current
development sources, but there is still a bug there.

The problem in your third example is also still present in the current
development sources.  The 5th and 6th command lines should give errors about
nonexistent structure fields.  The 7th command line is correct behavior
however, because val.name produces a comma-separated list, but it is empty
because the structure array is empty, so there is nothing to assign.

I don't think your fourth example shows a bug in Octave because the cell array
of values that arg0.contents(p1) returns is empty.  Then you are trying to
extract the first value which does not exist, so you are indexing outside the
bounds of the cell array and that behavior is undefined.

    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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