News for hackers. Stuff that matters.
Re:The 4-chan Go programmer by stroupwaffle on Wednesday August 28, 2024 @05:13PM (#41384443)
I think something people forget is that computer programming is a craft which must be honed.

A lot of people are introduced to it because computers are such an important part of every discipline, but unfortunately the wealth of mistakes maintaining many a code base occur from those who, quite honestly, simply lack experience.

In the authors case, they don’t explain the simple understanding that every pointer is simply adding a dimension to the data.

int *data; // one dimensional vector

int **data; // two dimensional matrix

int ***data; // three dimensional matrix

Which is one way to interpret things. The problem is that when folks learn computer programming using Python (or another high level language), it’s like using power tools bought from the hardware store compared to some ancient, Japanese wood working technique. The latter takes time to understand and perfect.

Ten thousand hours, so I’ve heard ;)

Re:The 4-chan Go programmer by THBC on Wednesday August 28, 2024 @05:31PM (#41384623)
”every pointer is simply adding a dimension to the data.”

No, it’s not. The concept of having a pointer to a pointer has nothing to do with the concept of dimensionality.

You must be thinking of lists of lists (of lists…), which can be implemented using pointers. The dimensionality, however, comes from the structure of the list, not from the pointers.

Re:The 4-chan Go programmer by YZF on Thursday August 29, 2024 @12:22AM (#41387289)
Right. -ish. A two dimensional array can be modeled as an array of pointers to one dimensional arrays or as one pointer to a two dimensional array. Both have use cases. It's probably a right of passage for someone new to the C language to understand that difference (I learnt C as a teenager and it took me some time, months, to comprehend all the different permutations of pointers and square brackets).
Re:The 4-chan Go programmer by stroupwaffle on Thursday August 29, 2024 @09:22AM (#41390549)
I guess you skimmed over: “Which is one way to interpret things”

I’m certainly not thinking of a list-of-lists. In actuality, pointers ARE dimensionality, regardless of the intended use.

I’m not going to spell that out further. If you can’t see that, then you’ve got some work to do if you’re maintaining a C codebase.