3 ms·
How would it not make a difference? If you calculate an index at runtime, to get access to the element, in 0 based would be pointer + index. In 1 based it is ho
by Yujf 4y ago
How would it not make a difference? If you calculate an index at runtime, to get access to the element, in 0 based would be pointer + index. In 1 based it is however pointer + index - 1 clearly there is an extra subtraction there?
In x86 you could probably hide it in the addressing but that does not mean it does not to be computed
- goatlover 4y agoIf you’re calculating indexes at runtime, you’re probably not worried about that level of optimization.
- bee_rider 4y agoOne option, at least, would be for malloc and friends to return pointer-1, rather than pointer. That said, I'm sure a compilers expert could come up with a much better option.