You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why defining custom fixed-width integer types and even size_t?
Because most projects target common platforms (Windows, Linux, macOS), thus
using either the ILP32, LP64, or LLP64 data models, which all guarantee the
char type to be 8 bits, short to be 16 bits, int to be 32 bits, and
long long to be 64 bits. If such types can be accurately defined in a few
lines for most of the projects, then why including a standard header that
resolves to thousands of lines of code with its dependencies? For the exotic
platforms, the macro ZR_USE_STD_FIXED_TYPES can be defined, or each type can
be overridden individually.
The same applies to redefining size_t—on almost all platforms the size of
size_t equals the targeted architecture, that is either 32 or 64 bits. Here
again, if that's not enough then it's still possible to define
the macro ZR_USE_STD_BASIC_TYPES.
Note that these custom types are only used for the public interface defined in
the headers, to avoid cluttering project headers including them. But the
implementation sections make free use of standard headers as needed
(including standard fixed-width integer types and size_t).