4 ms·
It's 100% acceptable. You should not remove something from a list unless you know it is there. Since you won't attempt to remove something that doesn't exist, a
by souprock 6y ago
It's 100% acceptable. You should not remove something from a list unless you know it is there. Since you won't attempt to remove something that doesn't exist, any code to check for that situation is an unjustified performance loss.
(separate code exists for searching a list)
This... is not Python. C programmers, particularly kernel developers, have that style even in 2020.
- Animats 6y agoI hope not. Kernel programmers need to be paranoid. This is a classic idea for doubly linked lists. The empty list has the head element linked to itself in both directions. Buffer rings are sometimes organized that way. The cases for doubly linked lists are messier. Bear in mind that in modern CPUs, branches to nearby code are almost free, but indirection to far memory is expensive.