structs, custom type
Sat Mar 13 04:10:35 PST 2004
On Fri, 2004-03-12 at 05:34, Olivier Andrieu wrote:
> I still see an interest in CUSTOM as it is now : an amorphous byte
> stream without any DBus type information (except the name). It's
> almost the same as a STRUCT with a single element of type `string' or
> `byte array' except that the mapping of byte array or string may not
> be the best type to represent binary data in the target language.
Can you give me an example of such a language? "byte array" pretty much
means "binary data" to me...
> Btw, can DBus strings contain nul bytes ?
No, they are nul-terminated UTF-8. A nul byte would be invalid Unicode,
and also require a char*/len pair in C, rather than just a char*.
> The spec does not seem to
> specify this.
Would be good to add.
> If not, then that means you'll have to use a `byte
> array' typecode to transmit binary serialized python data (for
> instance). But then the python bindings may choose to map this to a
> list of ints or a list of characters whereas python unserialization
> expects the data to be in a string.
I'd expect byte array to go to a string in a language that allows nul
bytes, probably. Unless the language expects strings to be valid
> I'm not sure. ANY can seriously undermine the idea of a type
> signature: in a pathological case, the type signature could contain
> only anys, leaving the actual typecodes in the body. So perhaps ANY
> should only be allowed in some contexts (within an array). Sounds
It seems cleaner than DICT to me if we can get rid of DICT.
> Are DICTs really necessary ? couldn't they be subsumed by STRUCTS ?
Structs have a fixed number and type of elements for a given struct
More information about the dbus