Closed vassik closed 8 years ago
@acartero will soon create a test about that
Hopefully, @ffleurey will fix the bug sometimes soon...
As the serialization / de-serialization generation in c was re-written, this should no longer be a problem.
Meanwhile, I strongly recommend against the use of the type int
in c when using ThingML, as its length can change depending on the hardware/compiler, and if you define int
as 2 bytes long on hardware on which it is defined as 4 bytes long, you will have an issue with negative values.
In general, signed types with various length should not be used in my opinion. int16_t
or int32_t
should be preferred whenever it's possible.
C and C++ compilers regard an Integer type in ThingML as an unsigned int. Consider the following simple example
Integer is defined as
Actual output:
Expected output:
Note: I believe the error is here