3 ms·
The size of primitives in bytes is something that will rarely matter and when it does, you can look it up.
by bena 2y ago
The size of primitives in bytes is something that will rarely matter and when it does, you can look it up.
- Moru 2y agoDon't they also dependon the architecture you are programming? 8-16-32-64 bit computers? Or did they standardise the names since I learned C (and never used it) 30-40 years ago?
- unwind 2y agoIt was in C#, not C. In C they are not standardized but there are requirements on relative sizes. Since C99 we also have `int32_t` and friends that expose sizes.
- bena 2y agoThis was about C#, not C or C++. So it's a little more involved. The CLR, which C# targets, has explicitly sized types. There is no "int", there's only "Int32", which is a signed 32-bit integer. C# maps keywords to certain CLR types. "int" always maps to Int32. It's a guarantee in C# and I think a requirement of all languages targeting the CLR.