recursive types work

Havoc Pennington hp@redhat.com
Mon Jan 24 15:20:48 PST 2005


On Mon, 2005-01-24 at 16:56 -0500, Joe Shaw wrote:
> 
> Does this mean that empty arrays should be disallowed by the bindings?

Nope

> I expected dbus_message_iter_recurse() to have a return value similar to
> dbus_message_iter_init(), but instead it doesn't have any return value.
> But you can still recurse into the empty array, and this trips an
> assertion.  Is this is a bug?
> 

Recursing into an empty array should work (no assertion), it's a bug if
it fails.

Recursing into a *nonexistent* array though should not work, and should
assert.

In other words if you have array of array of int, and you have zero
elements in it; then you can recurse into the array of array of int (and
the resulting sub-iterator will already be at the end, i.e. you can't
read any elements). But you can't recurse into array of int, because
there is no array of int - there's no valid iterator position to recurse
into.

It's trivial to export an iter_init_types_only() that would let you walk
the type signature rather than the values, if that would be helpful.

Havoc




More information about the dbus mailing list