is_linked is badly named
przygienda opened this issue · comments
Tony Przygienda commented
it only checks next (even in doubly linked case).
this would be more logical has_successor or something like this
there is now no real method to figure out whether a node is really linked onto the list on not on it.
Amanieu d'Antras commented
next
contains UNLINKED_MARKER
if the node is unlinked, whereas it contains 0
/null
when there is no next element in the list. is_linked
will correctly return false for the last element in a list.
Tony Przygienda commented
my gripe is only with 'is_linked', this is not equivalent to 'has_next' and
it's very noticeable in code on doubly linked list
…On Fri, Sep 10, 2021 at 1:53 PM Amanieu ***@***.***> wrote:
next contains UNLINKED_MARKER if the node is unlinked, whereas it
contains 0/null when there is no next element in the list. is_linked will
correctly return false for the last element in a list.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#63 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AANDICZEQ7IVYL7UXPFRCJLUBHWVJANCNFSM5DZFH3PQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
Amanieu d'Antras commented
I don't understand what the problem is: is_linked
tells you whether a node is linked into a list. It does not tell you whether there is another node before/after this one.