[Differential] [Commented On] D285: Factor bucket chain search into walkBucketChain
olivierjg (Olivier Jean de Gaalon)
noreply at phabricator.kde.org
Sun Sep 27 07:49:11 UTC 2015
olivierjg added inline comments.
serialization/itemrepository.h:1833 I do understand what you're saying by return types being odd, but having walkBucketChain return void or bool is not really a readability improvement in any situation.
We don't want void, since that means we /require/ a sentinel value to tell us if we broke early or found nothing, which won't necessarily be useful otherwise. Ie, in deleteItem, if found we set one value, else another one, so we'd either have to initialize it to zero and then set it again if found, or add another bool to tell us that it was found.
We could just have walkBucketChain return, but aside from just being noisier, it seems like premature pessimization. I think for this case where we are always working with pointers or zero-invalid bucket indexes, it makes some sense to have it as it is. Of course if you still find it undesirable, I'll change it.
To: olivierjg, KDevelop
Cc: kdevelop-devel, mwolff, KDevelop, arrowdodger, obogdan, kfunk
More information about the KDevelop-devel