Page 1 of 1

djgpp gcc inline functions

Posted: Thu Jun 19, 2003 8:23 pm
by be
Can anyone tell me, does gcc put prologue and epilogue code (registers saving) in inline functions? And how do they compiled? I mean, if inline functions don't have prologue code it can be good idea to use them as interrupt handlers. ???

Re:djgpp gcc inline functions

Posted: Fri Jun 20, 2003 1:11 am
by Pype.Clicker
as the name says, inline function are **inlined**. If used correctly, their body appears nowhere in your code but in the calling function.

As soon as you put a reference to the inline function somewhere, GCC generates a 'real' function that has the same effect as the inlined code, so that you can jump to it, etc.

So definitely, it would be a *bad* idea to do so for interrupt handlers.
Sorry, dude: you'll have to go through the asm-based interrupt stub like everybody ;)

Re:djgpp gcc inline functions

Posted: Fri Jun 20, 2003 7:57 pm
by be
What commands certainly put DJGPP in prologue and epilogue of functions? And why x86 target doesn't have 'naked' keyword?

Re:djgpp gcc inline functions

Posted: Sat Jun 21, 2003 2:04 am
by Pype.Clicker
prolog: "push ebp; mov ebp, esp"
epilog: usually "pop ebp", sometimes "mov esp, ebp" before, sometimes "leave" instead ... seems to depend on the compiler's mood.

and for the "naked" keyword, i guess this is because it's not ANSI C...