Two use cases for which I would consider short
come to mind:
There is never a reason to use short
in a C99 environment that has 16-bit integers; you can use int16_t
, int_fast16_t
or int_least16_t
instead.
The main reasons for using short
is backward compatibility with C89 or older environments, which do not offer these types, or with libraries using short
as part of their public API, for implementing
itself, or for compatibility with platforms that do not have 16-bit integers so their C compilers do not provide int16_t
.