3 ms·
> As far as I know, these are not optimizations a compiler is capable of. If <some code> has side effects I don’t want the compiler to make that optimization a
by gumby 5y ago
> As far as I know, these are not optimizations a compiler is capable of.
If <some code> has side effects I don’t want the compiler to make that optimization as the order might be important and there is no way to tell.
(If there are no side effects the compiler can optimize — by removing the loop!).
You can tell the compiler you don’t care about order by replacing the for loop with an algorithm like for_each which is allowed to do this kind of thing, and can take a parallel policy too.
(Though is there an implementation that uses execution policies?)