October 9th, 2010, 01:49 PM
Is there a reason not to use really large data types ?
Is there any reason not to just use the 'long' data type for storing numbers instead of a smaller one like 'int' ?
Do they take up more memory or something ?
October 9th, 2010, 02:46 PM
The answer to this question is fairly complex and depends greatly on what programming language you are using.
Ints are usually <= 4 bytes, and while longs are usually >= 4 bytes. So, in some cases longs do use more memory than ints, and in some cases they use the same amount. I am fairly certain that longs never use less memory than ints.
The matter is further complicated by the fact that many computer architectures have a minimum size limit on individual chunks of data. In many cases this limit is 4 bytes. For this reason, even if an int is defined as being only 2 bytes it might consume the same amount of space as a 4 byte long.
October 21st, 2010, 02:01 AM
I think it has much thing to do with the memory.