performance - Most efficient pointer arithmetic type in c -
i assume internal casting happens when write: arr[i]
(which equivalent *(arr+i)
). because i
can example short
, int
or long
or unsigned variant of of these three.
so question simple: type should i
no internal conversion takes place? code can run efficiently?
crude guess: size_t
?
it's unlikely make significant difference performance. in case, should using type that's semantically correct, not trying make premature optimizations things aren't going matter. in case of indices, size_t
smallest type that's a priori correct, may able away smaller types if know array you're working bounded. though should use size_t
safe.
Comments
Post a Comment