return value of size()
is uint32_t for hash_set and hash_map while others are usually int
#84566
Labels
size()
is uint32_t for hash_set and hash_map while others are usually int
#84566
Godot version
Godot v4.2.beta (5ee9831)
System information
Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.3619) - 11th Gen Intel(R) Core(TM) i7-11700K @ 3.60GHz (16 Threads)
Issue description
In hash_map.h or hash_set.h we have:
_FORCE_INLINE_ uint32_t size() const { return num_elements; }
but other container's size() function all return int, like this in cowdata.h:
I guess we can do some clean up here. Better to change hashset's size() to return int, as uint32_t is good but may overflow when do some math about it.
Steps to reproduce
I met this problem when trying to add a hashset's size to a vector's size, and with treat warning with error on, the compiler complains about
'!=': signed/unsigned mismatch
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: