Season’s greetings to you all.
Is there a way to mark a function as having no side effects, so that it is allowed to commute with other functions?
It is often the case that a function will not have side effects that are visible from outside the function (e.g. the function allocates some memory, performs a computation, and deallocates). Under such an assuption, the function call commutes with other function calls, unless a memory limit is reached during allocation (i.e. malloc has no more available space).