In the wikibook x86 Disassembly
, it is written that sometimes there are subroutines that do not set up standard stack frames. One such case is when we declare a static function in C. The following lines have been written in the book.
When an optimizing compiler sees a static function that is only referenced by calls (no references through function pointers), it "knows" that external functions cannot possibly interface with the static function (the compiler controls all access to the function), so the compiler doesn't bother making it standard
.
I have following questions regarding the above statement :
- Is it possible for an external function to refer to a static function using function pointer? If yes, how? Why is it allowed? (I am asking this because as far as I know, static functions have local scope and cannot be accessed by any external functions)?
- What does having a non-standard stack frame mean? How do non-standard stack frames differ from the standard ones? An explanation using assembly code would be welcome :)
Edit: Another question I would like the answer to: Why does the compiler in the above mentioned case set up non-standard stack frame instead of the standard one?