from Hacker News

Dangling pointers: The bane of every C/C++ programmer's existence?

by ishankbg on 6/25/24, 3:43 PM with 1 comments

  • by bediger4000 on 6/25/24, 5:52 PM

    This is a narrow view. What about the ".next" element of a linked list node that's moved to the tail of the list? If you're not using null to indicate end of list, .next is semantically wrong but harmless.

    Perhaps a better example is Knuth's Dancing Links. A node is taken out of a larger data structure, pointers left unchanged, because the node will be reinserted later.

    "Dangling pointer" is intuitive, but ultimately too broad to have much meaning.