News for hackers. Stuff that matters.
Re:Conflating pointers with arrays: C's biggest mistake? (2009) by m_mueller on Sunday July 22, 2018 @02:51AM (#17585571)
I’ll add to this that C having committed to this mistake is one of thr main reasons some people (scientific programmers) are still using Fortran. Arrays with dimensions, especially multidimensional ones, allow for a lot of syntactic sugar that are very useful, such as slicing.
Re:Conflating pointers with arrays: C's biggest mistake? (2009) by geoalchimista on Sunday July 22, 2018 @04:54AM (#17585900)
Modern Fortran (90 to 2008) has evolved a lot regarding array arithmetic and broadcasting, yet still maintain backward compatibility. I don't think that couldn't be done in C, but as many has pointed out, the problem seems to be why bother when there are already C++/D/Java/C#/Go/Rust ...

However, I'd recommend people who deal heavily with multidimensional arrays but couldn't sacrifice the low-level C environment for a dynamic language to consider using the ISO_C_BINDING of Fortran 2003. It provides fully C compatible native types, and can be compiled together with C (you get gfortran from GCC anyway).

Re:Conflating pointers with arrays: C's biggest mistake? (2009) by macintux on Sunday July 22, 2018 @10:57PM (#17590274)
Without knowing Fortran, I’d speculate it’s easier to maintain backwards compatibility in a language that doesn’t have as direct a mapping to hardware as C. Fortran seems to have more abstractions built in.
Re:Conflating pointers with arrays: C's biggest mistake? (2009) by geoalchimista on Monday July 23, 2018 @12:43PM (#17593909)
That's true. It predated C but even then abstracted the user away from the hardware (and still does). I wouldn't suggest any use of Fortran beyond number crunching and array arithmetic.
Re:Conflating pointers with arrays: C's biggest mistake? (2009) by Athas on Sunday July 22, 2018 @04:11AM (#17585797)
Hell, you don't even have to go to slicing for language-supported multidimensional arrays to make sense. Simply being able to index with a[i][j] is so much nicer than the manual flat addressing a[i*n+j] that you end up with in C. (a[i][j] does work in C, but only if the array dimensions are constants.)