Mail Archives: djgpp/1999/12/31/11:57:04
On 31 Dec 99, at 0:03, sl wrote:
> On Fri, 31 Dec 1999 03:11:20 GMT, Damian Yerrick wrote:
>
> >I don't know that much about inlining, but try dropping all your
> >inline functions into a header file and #includeing it from your
> >source files.
>
> I tried simply adding #include "name.cc" in the top of the header
> file for the "offending code" .. but it did not help.
>
> Gili
>
>
Greetings Gili,
I think what you should do is that you should move your say
plotpixel and other inlined fuctions to header files.
The following should be in you Header file which you include. I'm
using graphics.h for an example.
//file graphics.h
inline void put_pixel(int x,int y)
{
// your drawing code goes here
}
The above code will be in your graphics.h file.
And if i have a file called game.cc which needs to use the put_pixel
routine i will include the header which contains the inlined put_pixel
function (graphics.h in this example) like below.
//file game.cc
#include "graphics.h"
void main()
{
put_pixel(0,0)
}
So when the compiler sees the call to the put_pixel function it will
replace it with the code in the header file without the overhead of a
function call.
I hope this helps and is clear. Please donot include the source as
#include name.cc instead copy the inline fuctions to a header file
and include it.
If this is not clear please tell me (I'm writing this 1 1/2 hours before
the new milennium!).
Best Wishes to everyone for the new milennium.
Kalum
- Raw text -