News for hackers. Stuff that matters.
Re:Applying the Linus Torvalds “Good Taste” Coding Requirement by apk17 on Wednesday October 26, 2016 @06:19AM (#12795270)
Actually, I find the double pointer version easier to understand, and incidentally it is also the way always wrote this in C. And I pitied the pascal programmers who had to use the original version.

'Simplify so a fool can understand your code, and you will have fools editing it.'

Re:Applying the Linus Torvalds “Good Taste” Coding Requirement by kwhitefoot on Wednesday October 26, 2016 @09:49AM (#12796387)
Pascal has references and pointers too so why would they not be able to do it in a very similar way?
Re:Applying the Linus Torvalds “Good Taste” Coding Requirement by apk17 on Wednesday October 26, 2016 @04:20PM (#12800091)
In the original pascal pointers/refs came only out of new (AFAIR), you couldn't point into structures or to local variables. That makes this trick impossible.

'Modern' 'pascals' were different.

Re:Applying the Linus Torvalds “Good Taste” Coding Requirement by kwhitefoot on Thursday October 27, 2016 @02:17AM (#12803225)
I'll grant that you can't do it quite as efficiently as in C but you can do the same trick as I showed for VB.Net (in another post in this thread) and create a new entry that points at the head then use that as your indirect pointer. The problem is caused not by being unable to point at locals or members but by Pascal's pointers being strongly typed so that you can't simply dereference some random word length memory cell to get a new reference.

So not identical but still simpler than the tasteless version.

I thought that this was such a fundamental idea that it should be on Rosetta Code but the page for it at http://rosettacode.org/wiki/Singly-linked_list/Element_remov... is empty.

Perhaps we should all rush over there and fill it in. :-)

Edit: See entry on RC at http://rosettacode.org/wiki/Singly-linked_list/Element_remov...