I am in the process of trying to learn C's more advanced aspects and wrote this when experimenting with the __inline__ keyword:
#include <stdio.h> void f(int); void g(int); __inline__ void f(int egg) { printf("f %d\n", egg); g(egg); } __inline__ void g(int egg) { printf("g %d\n", egg); f(egg); } int main() { f(123); return 0; } I went to the GNU manuals and found that the -Winline compiler option warns when a function marked __inline__ can't be substituted.
I was indeed expecting a warning, but I compiled this program with gcc -ansi -pedantic -Wall -Wextra -Winline -o test test.c and there were no warnings.
When I ran the program, it printed out the number a whole bunch of times before a segmentation fault, presumably due to the recursion limit being exceeded.
My question is, how does gcc behave in cases like that? If it does inline the functions, how does it know it hit a recursive call between two functions?
Thank you in advance

inline, instead of the implementation extension,__inline__?__inline__has never been a keyword of any version of standard C, and it is unlikely to be a keyword of any future version, as its form is reserved for implementation use. Do not confuse implementation extensions (such as__inline__) with standard features, and do not confuse studying the behavior of a specific implementation with studying the behavior required of all conforming implementations.