3 ms·
Where does the double dereference come from in the second case? curr->next and (* curr) both perform a dereference. (If anything, (* curr) will be at least as e
by to3m 14y ago
Where does the double dereference come from in the second case? curr->next and (* curr) both perform a dereference. (If anything, (* curr) will be at least as efficient, if not more, because there's guaranteed to be no offset.)
(Does anybody know how you type an asterisk?)
- demallien 14y agoMost CPU architectures offer special optimised instructions for grabbing data in a structure - it's done as an offset from the base pointer. A double star dereference can not benefit from this optimisation.
- to3m 14y agoI think there are the same number of dereferences in both cases? One to fetch the next pointer, and one to update the previous next pointer if a removal is required. You could probably make the second bit of code worse by not holding the value of star curr in entry.
- deleted 14y ago[deleted]
- deleted 14y ago[deleted]
- gsg 14y ago* * curr Unfortunately the spaces seem to be unavoidable.