You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@plc4x.apache.org by Christofer Dutz <ch...@c-ware.de> on 2021/05/04 12:37:19 UTC
[NOTICE] New "byte" simple type in mspec
Hi all,
I a morning hacking session Sebastian and I implemented a new simple
type in mspec: byte
In contrast to int and uint this doesn't have a size, so it's more like
the "bit" which has a fixed size.
We decided to introduce this for situations in which we want to
transport data and not have it interpreted. The problem was that in
order to have it map to a "byte" in Java, the mspecs needed to use "int
8", while in go and c a "uint 8" would have been a better match.
Now a byte maps to that type that typically is used in that particular
language. So for Java it maps to a byte (8 bit signed integer) and in C
and Go it maps to an 8 bit unsigned integer).
This change has absolutely no effect on existing drivers, unless you
change the mspec to use the new type.
Sebastian is currently working on a shorthand to auto map: "[array byte
...]" directly to a byte[] (or []byte) so we even can get rid of reading
bytes into lists.
Chris