d - Preferred foreach Index Type -
what preferred type loop indexes when using foreach in d, int, uint or automatic omitting type?
in general, indices should size_t. same length. you're going have issues 32-bit vs 64-bit machines if try , use int or uint. size_t language uses array indices , length. it's aliased uint on 32-bit machines , ulong on 64-bit machines.
so, if you're going give index type, give size_t. however, type inferred size_t foreach when iterating on array. so, in cases, there's no reason list type.
Comments
Post a Comment