Closed VNovytskyi closed 1 year ago
Not the author, but from what I understand:
The proper type to handle the array size would be size_t
, as is done inside the function.
But due to backward compatibility, the return type has to stay int
.
This is problematic for two reasons:
Usually size_t
would be defined as an unsigned type, while int
is a signed type.
Additionally, depending on the target architecture they could be values of different size.
Both these points could potentially pose a problem (overflow) for very large arrays, hence the FIXME
.
Hello! Can someone explain to me the FIXME message in the function cJSON_GetArraySize?
I am developing the wrapper module for the cJSON library and can use my own implementation of this function.