mkirchner/linked-list-good-taste

Crash

jtgd opened this issue · 1 comments

jtgd commented

To me elegant code is not only efficient but also bulletproof.

remove_elegant will crash if:

  1. List is empty, and head is NULL
  2. target is not on the list. (does not check for final node's NULL)

There is NO NULL testing in there at all. It totally assumes the list is never null and target is always on it.
Poor code IMO.

The code in this repository illustrates a specific, interesting use of a data structure and attempts to explain the underlying concepts that make it work. Your observation is correct, but the critique is beside the point and the solution clearly beyond the scope of this little writeup.

Closing.