New to languages in general that requires the developer to be aware of memory details, so apologies for the noob questions, but I was wondering why is it useful that the the compiler knows the size in memory a type takes at compile time?
Is this used for some optimization? if so what kinds?
Can one infer the size of the binary produced from the size of the types? That is, will a program using the i128
type produce a bigger binary compared to a program that uses u32
?
Or this “knowing of types” only affects the size of the memory the program will use at runtime? If it is only about memory usage at runtime, how? I mean if I have a function with all the types known at compile time, how does this affects memory usage at runtime?
I mean, dynamic languages don’t have the luxury of a compile time to know the types and yet, they work…so what is the difference?