It makes sense long would have needed a comment. It needs a comment because “long” and “double” are terrible names for data types. Long what? Double length what? Those type names could easily have opposite meanings and meant long floating point / double length integer. WORD/DWORD are nearly as bad - calling something a "word" incorrectly implies the data type has something to do with strings.
If you don't believe me, ask a non programmer friend what kind of thing an "integer" is in a computer program. Then ask them to guess what kind of thing a "long" is.
The only saving grace of these terms is they’re relatively easy to memorise. int_16/int_32/int_64 and float_32/float_64 (or i32/i64/f32/f64/...) are much better names, and I'm relieved that’s the direction most modern languages are taking.
(Edit: Oops I thought Microsoft came up with the names WORD / DWORD. Thanks for the correction!)
Why should a non programmer understand programming terms? Words have different meanings in different contexts. That's how words work. There is no need to make these terms understandable to anyone. The layman does not need to understand the meaning of long or word in C source code.
Ask a non-golf player what is an eagle or ask a physicist, a mathematician and a politic the meaning of power.
Word and long may have been poor word choices, but asking a non-programmer is not a good way to test it.
int is neither 32 nor 64. Its width corresponded to a platform’s register width, which is now even more blurred because today’s 64 bit is often too big for practical use and CPUs have separate instructions for 16/32/64 bit operations, and we agreed that int should be likely 32 and long 64, but the latter depends on a platform ABI. So ints with modifiers may be 16, 32, 64 or even 128 on some future platform. intN_t are different fixed-width types (see also int_leastN_t, int_mostN_t, etc in stdint.h; see also limits.h).
Also, don’t forget about short, it feels so sad and alone!
In C, long is not the name of a data type, it is a modifier. It turns out that C standard type is integer, so if you say long without another data type (such as double, for example), this means long int.
That made me curious. From section 2.2 of the 2nd edition of K&R, 'long' is not a type but a qualifier that applies to integers (not floats though), so you can declare a 'long int' type if you prefer.
josephg|5 years ago
If you don't believe me, ask a non programmer friend what kind of thing an "integer" is in a computer program. Then ask them to guess what kind of thing a "long" is.
The only saving grace of these terms is they’re relatively easy to memorise. int_16/int_32/int_64 and float_32/float_64 (or i32/i64/f32/f64/...) are much better names, and I'm relieved that’s the direction most modern languages are taking.
(Edit: Oops I thought Microsoft came up with the names WORD / DWORD. Thanks for the correction!)
yiyus|5 years ago
Why should a non programmer understand programming terms? Words have different meanings in different contexts. That's how words work. There is no need to make these terms understandable to anyone. The layman does not need to understand the meaning of long or word in C source code.
Ask a non-golf player what is an eagle or ask a physicist, a mathematician and a politic the meaning of power.
Word and long may have been poor word choices, but asking a non-programmer is not a good way to test it.
zokier|5 years ago
"Word" as a term has been in the wide use since at least 50s-60s, you can't really blame MS for that
https://en.wikipedia.org/wiki/Word_(computer_architecture)
iasmseanyoung|5 years ago
The PDP-9, PDP-10, and PDP-18 have 18 bits registers. The world had not settled on 16/32/64 bits at all.
Even the intel 80286 far/fat pointers are 24 bits.
Symbiote|5 years ago
"long" was commented out.
bpgate|5 years ago
The real mistake in retrospect is that int and long are platform dependent. This is an amazing time sink when writing portable programs.
For some reason C programmers looked down on the exact width integer types for a long time.
The base types should have been exact width from the start, and the cool sounding names like int and long should have been typedefs.
In practice, I consider this a larger problem than the often cited NULL.
wruza|5 years ago
Also, don’t forget about short, it feels so sad and alone!
_kst_|5 years ago
I think you misunderstood. There's no explanatory comment. The "long" keyword is commented out, meaning that it was planned but not yet implemented.
kps|5 years ago
(b) Many important machines had word sizes that were not a multiple of 8.
coliveira|5 years ago
elvis70|5 years ago
unknown|5 years ago
[deleted]
innocenat|5 years ago
(I know it's floating point, but it's the same as long/double).
rightbyte|5 years ago
for is missing too.