It is well known that the evaluation order of actual arguments varies from one C compiler to the other. But as ISO 9899:1999 states in §6.5.2.2.10:
The order of evaluation of the function designator, the actual arguments, and subexpressions within the actual arguments is unspecified, but there is a sequence point before the actual call.
I never came across a compiler which generates code where the function designator is evaluated after or interleaved with the actual arguments since I started using C in the eighties. Is it therefore "safe" to use the following (simplified) code in an application:
void* self;
(self = getPointerToObject())->classPtr->methodX(self);
or is it really necessary to do something like:
void* self;
int (*methodPtr)(void*);
(methodPtr = (self = getPointerToObject())->classPtr->methodX, methodPtr(self));
to get an explicit sequence point between the function designator and argument evaluation (at some performance cost)?
Are there C compilers out there which would generate code where the first code snipped would not work (i.e. feed an undefined self argument to methodX)?