This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,all
Is it feasible to declare a function as inline and then realize this function using assembly code?But it will cause the compiler error.
Such as:
//Declartion:
inline int func(void);
main()
{
……
int a = func();
……
}
And func() is realized in another asm file.
Allen
Allen,
No, that's not possible. When you declare a function inline, the pre-processor substitutes the C code in wherever that function is called. It's kind of like a macro. If there was assembly substituted in there, the compiler wouldn't know what to do with it.
If you want the performance of assembly while using the C language and inline functions, try using intrinsics.
hi Luke,
Thanks for you suggestion.
It seems a feasible way to realize the inline function by intrinsics in order to reduce the function-call-cost.
Allen
You can't put them in parallel, but the compiler will look for opportunites to put the generated instructions in parallel.