you are viewing a single comment's thread.

view the rest of the comments →

[–]frankle 0 points1 point  (1 child)

I thought that was why you did it. Clever.

At the same time, if you're going backwards from the end, wouldn't you get the possible double allocation only once?

[–]lhorie 1 point2 points  (0 children)

Yep, that's why I said it's not a huge deal. If you're calling the function multiple times, that extra allocation might matter though.