Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Funny. Linus Torvalds somewhat feels this way judging by this https://m.slashdot.org/story/176163

Repeated below:

At the opposite end of the spectrum, I actually wish more people understood the really core low-level kind of coding. Not big, complex stuff like the lockless name lookup, but simply good use of pointers-to-pointers etc. For example, I've seen too many people who delete a singly-linked list entry by keeping track of the "prev" entry, and then to delete the entry, doing something like

if (prev) prev->next = entry->next; else list_head = entry->next;

and whenever I see code like that, I just go "This person doesn't understand pointers". And it's sadly quite common.

People who understand pointers just use a "pointer to the entry pointer", and initialize that with the address of the list_head. And then as they traverse the list, they can remove the entry without using any conditionals, by just doing a "*pp = entry->next".



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: