avoiding function calls by inline source code

bridged with qdn.public.qnxrtp.newuser
Post Reply
Winfried Böske

avoiding function calls by inline source code

Post by Winfried Böske » Thu Dec 04, 2003 12:48 pm

Hello,

I'm trying to speed up an application. And I've heard that it was
possible to insert "source" lines rather than function calls. So the
jumps could be avoided at the cost of memory consumation for my program.

Does anybody know how to configure the compiler (some hidden switches or
so) to automatically insert not the function calls but rather the source
lines while compiling the application?

Thanks.

Winfried

Mario Charest

Re: avoiding function calls by inline source code

Post by Mario Charest » Thu Dec 04, 2003 11:31 pm

If you declare function as inline it should do it. That only works within a
C file though, this is resolved at compile time and not at link time.

Unless your function is very short, sometimes it doesn't make that big of a
difference and can in some instances make it worst

"Winfried Böske" <winfriedboeske@yahoo.de> wrote in message
news:3FCF2D01.9010008@yahoo.de...
Hello,

I'm trying to speed up an application. And I've heard that it was
possible to insert "source" lines rather than function calls. So the
jumps could be avoided at the cost of memory consumation for my program.

Does anybody know how to configure the compiler (some hidden switches or
so) to automatically insert not the function calls but rather the source
lines while compiling the application?

Thanks.

Winfried

Bill Caroselli

Re: avoiding function calls by inline source code

Post by Bill Caroselli » Thu Dec 04, 2003 11:47 pm

Winfried B?ske <winfriedboeske@yahoo.de> wrote:
WBs > Hello,

WBs > I'm trying to speed up an application. And I've heard that it was
WBs > possible to insert "source" lines rather than function calls. So the
WBs > jumps could be avoided at the cost of memory consumation for my program.

WBs > Does anybody know how to configure the compiler (some hidden switches or
WBs > so) to automatically insert not the function calls but rather the source
WBs > lines while compiling the application?

WBs > Thanks.

WBs > Winfried

If it's a C++ program just stick 'inline' in front of your function. I.E.

inline int my_function ( )
{
// do something impressive
return something;
}

int main ( )
{
my_function();
}

In this program, there is no call to my_function. The code for
my_function is just copied inline to function main().

--
Bill Caroselli -- Q-TPS Consulting
1-(708) 308-4956 <== Note: New Number
qtps@earthlink.net

Post Reply

Return to “qdn.public.qnxrtp.newuser”