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

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

[Octave-bug-tracker] [bug #51633] Empty indexing of struct returns empty


From: Piotr Held
Subject: [Octave-bug-tracker] [bug #51633] Empty indexing of struct returns empty struct array
Date: Mon, 31 Jul 2017 15:06:01 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.86 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?51633>

                 Summary: Empty indexing of struct returns empty struct array
                 Project: GNU Octave
            Submitted by: jsoh425
            Submitted on: Mon 31 Jul 2017 07:05:59 PM UTC
                Category: Interpreter
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: None
             Assigned to: None
         Originator Name: Piotr Held
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

I apologize if this has been submitted earlier, I couldn't find it.

So with this code:

a = struct ('f', 1);
a()

Returns 

0x0 struct array containing the fields:
    f

For Matlab it is equivalent to:

a(1)


This might seem trivial in most cases, but if you had a class name 'class1'
and property name 'prop1'. If 'prop1' happens to be a struct your (somewhat
improper) code:

sth = class1.prop1();
sth.field1 = 5;

Fails when you try to assign something to a field of that struct.

Should I try to fix this, or is the code example I gave just "bad coding" and
it's better if the code doesn't execute?




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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