Remix.run Logo
bena 8 hours ago

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

Moru 8 hours 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?

unwind 7 hours ago | parent | next [-]

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.

bena 7 hours ago | parent | prev [-]

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.