Type of size


#1

Hi, it seems some JUCE API calls are using size_t, some are using int and some are using int64 for a size value. Is it possible to get these synchronised so we don’t have to cast to remove warnings? thx


#2

same goes for the dsp-class, which uses a wild mix between size_t and int, i prefer signed types


#3

From JUCE’s coding standards page (https://juce.com/discover/stories/coding-standards):

Most of the juce container classes use int as their index type, which differs from the standard library’s use of size_t, but it seems that over the years, the C++ standards committee have gradually come to feel that using an unsigned type was a mistake.

To me, this suggests that older JUCE code will likely be using size_t but as C++ standards have changed they’ve favored unsigned types instead.
Also, where JUCE is using standard library functions we’re likely to find a lot of size_t usage since the standard library still favors size_t over unsigned types. Because of this I’d say it’s unlikely we’ll see a change in this and since it’s only giving warnings and not errors then I doubt it’s high up their priority list.