3 ms·
> The array length is still there If it was, we wouldn't be having this discussion and array bounds checking would have been added to C compilers 40 years ago.
by WalterBright 4y ago
> The array length is still there
If it was, we wouldn't be having this discussion and array bounds checking would have been added to C compilers 40 years ago.
- Arch-TK 4y agoCan you explain then, when I write: struct s { int bar; int baz; } foo = { .bar = 5, .baz = 6, }; f(foo.bar); Has "foo.baz" decayed? If the answer is no then you have an answer for why there is no decay involved in the implicit conversion. The fact the function does not receive the array size does not mean that decay has happened. That being said, nothing I just wrote wasn't in the comment you replied to, so maybe explain what it is from that comment that you didn't understand about my argument for why "decay" is simply the wrong word for what is happening. Also: This has nothing to do with array bounds checking. Also: Given the nature of the C language, I would find it surprising if compilers 40 years ago would have implemented bounds checking irrespective of if the language started out with either fat pointers or some other way of carrying the size of a specific array around with a pointer to its first element.