4 ms·
In general avoid frivolous use of pointer arithmetic. foo[k] and *(foo+k) will usually generate identical asm, and the former is just easier to read…
by shash 1y ago
In general avoid frivolous use of pointer arithmetic. foo[k] and *(foo+k) will usually generate identical asm, and the former is just easier to read…
- danhau 1y agoUsually? I‘m willing to bet it will always. I wouldn‘t be surprised if the standard even specifies these two to be identical.
- 1718627440 1y agoa[b] is defined as syntactic sugar for *(a+b), so yes.
- cozzyd 1y agoAnd if you want to go for eclectic, you can do [k]foo