Comment

Comment by chihuahua

I started using C in the late 80s and have used C++ on and off since then. I've not been able to understand how it ever made sense to have a language where the size of int (and other types) varies depending on the platform and implementation.

I don't think I've ever been in a situation where I thought "I need this variable to have a type that's the 3rd smallest available, but I don't care how many bits it actually is. On some platforms, it will overflow at 32768, and on other platforms it will overflow at 2.1 billion, and I'm fine with either behavior."

Every time I choose a type for a variable, I'm thinking "32 bits is an appropriate size for this variable, and this other variable needs 64 bits".

I understand that these days we use int32_t etc, but why did the unpredictably-sized types ever make sense to anyone?

parent chihuahua 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton