1. Rationale: the programmer might want to return a void * rather than MyClass * because the function is part of a pimpl class; he wants to hide implementation details from the caller.
2. Defensive programming: the way the programmer tests the return of ErrorFunc() is fragile and requires knowledge of details of error handling routines; it would be better to abstract the test : if IsError( ErrorFunc(0, GET)) { ... } An exception may or may not be more appropriate, depending on the context of the calling program.
3. Bug: the compiler will try to call the destructor to type void. The programmer needs to cast temp: delete (MyClass *)temp;
4. Style: it would be better to declare temp within the function as type MyClass *, then cast the return value to void *.
5. Ok: It happens from time to time that a function expects the caller to free resources allocated by the function. The caller would be wise to use an auto ptr if he can.
Neil