Remix.run Logo
bena 10 months ago

The size of primitives in bytes is something that will rarely matter and when it does, you can look it up.

Moru 10 months ago | parent [-]

Don'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?

bena 10 months ago | parent | next [-]

This 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.

unwind 10 months ago | parent | prev [-]

It 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.