All examples in the header showcase the use of the type int in
structs that values should be parsed into (or serialized out of).
However, that is probably a bad idea if we consider the function
get_elem_size in the JSON library that calculates the field size:
static ptrdiff_t get_elem_size(const struct json_obj_descr *descr)
{
switch (descr->type) {
case JSON_TOK_NUMBER:
return sizeof(int32_t);
...
}
Hence, using int in structs on platforms where an int is not 32
bits wide (as rare as they may be) is probably a bad idea and will
lead to confusing errors and undefined behavior.
Signed-off-by: René Beckmann <rene.beckmann@grandcentrix.net>
|
||
|---|---|---|
| .. | ||
| json.h | ||
| jwt.h | ||