2 ms·
Adding fat pointers to C is a major redesign and the fact that the explanation fits within a short blog post doesn't make it an easy fix. If you don't add fat
by Arch-TK 4y ago
Adding fat pointers to C is a major redesign and the fact that the explanation fits within a short blog post doesn't make it an easy fix.
If you don't add fat pointers (thereby requiring a major re-design of the language and causing an endless amount of pain with regards to ABIs etc) then the solution, which involves removing the implicit conversion of an array to a pointer to its first element in expressions where it is not used as an operand of the sizeof operator, unary & operator or as a string literal used to initialise an array, certainly DOES make it harder to write C.
- WalterBright 4y ago> Adding fat pointers to C is a major redesign No, it isn't. I implemented it in D, and know what is involved. I've written two C compilers, as well. > the fact that the explanation fits within a short blog post doesn't make it an easy fix. Correct, but since I've actually done it, I'm in a good position to say it is an easy fix.
- Arch-TK 4y agoD is not C, your experience writing compilers doesn't make this an easy fix. The problem is not the cost of implementing this (trivial) it is the cost to the nature of the C programming language. This will never get past the C WG and will cause massive disruption to how C is used these days. The point is, it's an easy fix if you make a new language, it is a difficult fix if you want to call the end result C.