[vlc-devel] [PATCH] modules: use 16-bit ints for option counts

Lyndon Brown jnqnfe at gmail.com
Sun Sep 27 20:38:08 CEST 2020


On Sun, 2020-09-27 at 09:27 +0300, RĂ©mi Denis-Courmont wrote:
> No. size_t is the specified type for byte and array size in C.

Sorry? Where does the C standard define that size_t is the one and only
correct type to use whenever handling/storing array sizes? It's the
return type of sizeof() and such and the size param for malloc() and
friends, and I do absolutely agree that it's often the sensible choice
when handling array sizes.

But I don't see any reason for holding us back from using only the
storage space that we actually require here. We don't need more than
two bytes per count here, ever. This is certain. It's just wasting
hundreds of blocks of 16 bytes for absolutely no good reason. Whenever
we rarely use the counts for indexing or iteration or allocation,
they'll get auto-zero-extended to int/size_t size as necessary. There's
no issue.

I'm a little surprised that you're taking issue with this...



More information about the vlc-devel mailing list