There is no such thing as a macro in asm(it is just text replacement your code and takes place before the code is compiled). What your referring to is the function has been inlined, usually when the compiler decides to do it it's a good thing, there is no c++ wide way to do this but you can do something like this
class X {
__declspec(noinline) int member_func() {
return 0;
}
};
code taken from this answer.
This will prevent the function from being inlined. Keep in mind that most of the time inlining is a good thing because it gets rid of the overhead of the function call, it also has no real negative affects other than code bloat and debugging. Compilers are very smart and generally make good decisions about inlining. As you may already know you can use the inline
specifier in c++ to suggest to the compiler that the function should be inlined.
I also originally thought that a more portable way to prevent function inlining would be to call it from a function pointer, however this post says otherwise.
For people looking at this answer using gcc you can prevent inline like this void void __attribute__ ((noinline)) myfunc()
this looks like it works for clang too ( I am using Apple clang version 4.0 ) so that should cover most of the c++ compilers people will be using.