News for hackers. Stuff that matters.
Re:Why I Don't Like Golang (2016) by WalterBright on Wednesday June 12, 2019 @06:54PM (#20170190)
I love C, but it's biggest mistake is clearly the unstoppable decay of arrays to pointers:

https://www.digitalmars.com/articles/b44.html

A mistake that C++ missed an opportunity to fix.

Re:Why I Don't Like Golang (2016) by gerbilly on Thursday June 13, 2019 @09:24AM (#20174572)
I read the article you linked. It's too bad they didn't decide to pass a fat pointer with the array dimensions.

But when the article implies that null terminated strings and the problems associated with them are caused by arrays decaying to pointers, I get more skeptical.

I mean it's not as if arrays in C are bounds checked anyway, so how would that have helped implement strings any better?

I guess you could have bounds checked them in the stdlib code, but you certainly wouldn't have gotten it for free just by knowing the array dimensions.

Re:Why I Don't Like Golang (2016) by WalterBright on Thursday June 13, 2019 @02:41PM (#20177528)
> I mean it's not as if arrays in C are bounds checked anyway, so how would that have helped implement strings any better?

I've written an awful lot of C code, and I have much experience with the D way which uses arrays instead of null termination.

When I review a section of code consisting of strlen/strcat/strcpy/etc. I routinely find bugs in it, always centered around a mistake with the 0 termination.

When the array bounds are available, the compiler can optionally insert array bounds checks.

As for getting it for free, avoiding doing the strlen()'s is a big time saver.

Re:Why I Don't Like Golang (2016) by wbl on Wednesday June 12, 2019 @11:40PM (#20171619)
Arrays are for FORTRAN is I think the reason.