jsoncpp icon indicating copy to clipboard operation
jsoncpp copied to clipboard

May it better that using ArrayIndex= size_t rather than ArrayIndex=unsigned int?

Open biepenghaomie opened this issue 2 years ago • 1 comments

When I use size_t in 32bit version,it can work for get index of object.But when i transform my code compile to 64bit,it will error with match more than one opeartor. Finally,I find jsoncpp using ArrayIndex=unsigned int.It equal size_t which is usigned int in 32bit too.But size_t is usigned long long in 64bit. So,may it better that using ArrayIndex= size_t rather than ArrayIndex=unsigned int?Let cpp compiler tool chain decide to use unsigned int or usigned long long.

biepenghaomie avatar Jul 05 '23 08:07 biepenghaomie

I agree with this issue; unsigned int seems like an inappropriate type to use for array indices, since it is only required to be 16 bits wide, which need not be enough for indexing JSON arrays. std::size_t is a more fitting type since the address width serves as a natural upper bound on the width of array indices.

appgurueu avatar Jan 18 '24 18:01 appgurueu