Re:Why bother to remember when you can just use Google?
by dionidium on Thursday July 14, 2011 @07:37PM
(#2765652)
The sizes of primitives in C are implementation defined, but the sizes of primitives in some other languages (e.g. Java) are defined by the specification.
Re:Why bother to remember when you can just use Google?
by natesm on Thursday July 14, 2011 @07:53PM
(#2765690)
That's true, I was purely thinking in C there.
Re:Why bother to remember when you can just use Google?
by JoshTriplett on Thursday July 14, 2011 @09:00PM
(#2765879)
In C, it still applies when you use the stdint.h sized types, such as uint32_t and uint64_t.
Re:Why bother to remember when you can just use Google?
by JoshTriplett on Thursday July 14, 2011 @08:57PM
(#2765869)
This seems like a case where recognition matters more than memorization. On occasion, it can come in handy to memorize that on most modern 32-bit systems, INT_MAX == 2147483647. More often, it can come in handy to see that number or something close to it pop out in an unexpected place and immediately think "huh, that's (close to) INT_MAX". The same thing applies to 4294967295, 1048576, 65536, and the ASCII codes of various common characters.
Would someone actually ask this and expect a numerical response? The only correct answer is sizeof(int), right?