Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
nicoburns
· 4y ago · 0 comments
That's just convention though. There's no reason "[x]" couldn't have been defined to be "+ (x - 1) * sizeof". There would be no runtime cost to this, and the compile time penalty would be tiny even on ancient systems.
Comments
[–]
nwlieb
4y ago
Is `(x - 1)` not a runtime cost if `x` is a runtime variable?
[–]
vikingerik
4y ago
Not on many instruction architectures - addressing modes often support adding/subtracting a constant.