djgpp gcc inline functions

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
be

djgpp gcc inline functions

Post 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. ???
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:djgpp gcc inline functions

Post 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 ;)
be

Re:djgpp gcc inline functions

Post by be »

What commands certainly put DJGPP in prologue and epilogue of functions? And why x86 target doesn't have 'naked' keyword?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:djgpp gcc inline functions

Post 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...
Post Reply