+ 1
Why are there multiple variable types? Why couldn't there just be one variable type that holds any number?
4 ответов
+ 10
I imagine if every variable datatype had the same size as the largest datatype (in order for a single, universal datatype which can store all kinds of variables to exist), the program created will be bloat. Furthermore, the load dumped onto the compiler when it needs to identify if variables are used correctly for calculations (e.g. Can't add string to int) would increase exponentially.
+ 5
Do you put your dirty shocks together with your clean shocks in the same location?
+ 2
Data types have different sizes in memory, they are also treated differently. Floating point numbers use different registers than regular numbers, along with different instruction sets