[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Initializing structs with mixed non-empty fields and {} leads to empty s
From: |
PhilipNienhuis |
Subject: |
Initializing structs with mixed non-empty fields and {} leads to empty structs |
Date: |
Sun, 25 Mar 2012 14:55:10 -0700 (PDT) |
I'm not sure if this is a bug, so I ask here first:
## Case 1
octave-3.6.1.exe:1> s = struct ("a", {}, "b", 0)
s =
0x0 struct array containing the fields:
a
b
octave-3.6.1.exe:2> s.b = 65
error: invalid assignment to cs-list outside multiple assignment
## Case 2
octave-3.6.1.exe:4> s = struct ("a", [], "b", 0)
s =
scalar structure containing the fields:
a = [](0x0)
b = 0
octave-3.6.1.exe:5> s.b = 65
s =
scalar structure containing the fields:
a = [](0x0)
b = 65
octave-3.6.1.exe:6> s.a = {}
s =
scalar structure containing the fields:
a = {}(0x0)
b = 65
In case 1, assigning {} to a new struct doesn't work, while it can be
assigned once the struct exists (see Case 2). That looks inconsistent to me.
s(1).b = 65 succeeds, so apparently the initial size (dimension) of the
struct was set to 0x0 even while a non-empty field was specified in the
constructing statement.
Philip
--
View this message in context:
http://octave.1599824.n4.nabble.com/Initializing-structs-with-mixed-non-empty-fields-and-leads-to-empty-structs-tp4504166p4504166.html
Sent from the Octave - Maintainers mailing list archive at Nabble.com.
- Initializing structs with mixed non-empty fields and {} leads to empty structs,
PhilipNienhuis <=