3 ms·
The article you reference actually proposes new syntax: void foo(char a[..]) for passing an array pointer and length, and to eventually deprecate: void f
by mhandley 6y ago
The article you reference actually proposes new syntax:
void foo(char a[..])
for passing an array pointer and length, and to eventually deprecate:
void foo(char a[])
Personally I like this suggestion, but as the article is 12 years old, I'm obviously in a minority.
- jodrellblank 6y agoPsst, he didn’t just reference the article, he wrote it.
- mhandley 6y agoThanks for pointing that out! Still, his comment here doesn't quite match the article and certainly confused me. Is he now suggesting: void foo(char[] a) instead of what he originally proposed, which is: void foo(char a[..]) If so, that does seem cleaner. I still like the overall suggestion.
- WalterBright 6y ago> 12 years old Which is amazing. It's a simple, backwards compatible solution to buffer overflows. I know it works because it's been used in D for 20 years and has made buffer overflows a thing of the past. It's also nice because it implicitly documents the difference between a pointer to a single object and a pointer to an array of objects. Just this is a huge win, when used consistently.