I am new to C, and there is one thing I can not understand. When function returns something that is not bigger than register -- my compiler puts it in EAX. When I return big
And one more: would it be right to say that objects I want to return, larger than register should be stored in heap and returned by pointer to prevent all than stack manipulations?
Well, maybe. Honestly, the choice of "return by pointer" or "return by value" is one you should probably have better reasons to make than "I want the return to be faster." For example, it would be faster to return via pointer than via stack for large objects, but this isn't taking into account the greater amount of time it takes to allocate an object on the heap compared to the stack.
More importantly, return-by-pointer allows you to have opaque pointers, variably-sized objects and certain degrees of polymorphic behavior that are impossible in stack objects. If you want or need these kinds of behaviors, you should be using return-by-pointer anyway. If you don't, you can use return-by-value, or you can pass a pointer to an object allocated by the user (however they like) as a parameter and modify that parameter in your function (this is sometimes called an "out parameter" or something similar).
Choose the return method based on what you need and what your code does, not which you think is faster. If you find that you absolutely need the speed (after profiling and finding that the return is a bottleneck), then worry about this kind of micro-optimization.