Regarding GCC's behavior, it's documented here (emphasis mine):
GCC does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function, like this:
/* Prototype. */ inline void foo (const char) __attribute__((always_inline));
Otherwise, it depends on optimization settings.
Regarding GCC's behavior, it's documented here (emphasis mine):
GCC does not inline any functions when not optimizing unless you specify the ‘always_inline’ attribute for the function, like this:
/* Prototype. */ inline void foo (const char) __attribute__((always_inline));
Otherwise, it depends on optimization settings.
The only case you must use the inline
keyword is, if you're defining global functions in a multiply included header file. Otherwise youryou are going to violate the One Definition Rule principle.
The only case you must use the inline
keyword is, if you're defining global functions in a multiply included header file. Otherwise your going to violate the One Definition Rule principle.
The only case you must use the inline
keyword is, if you're defining global functions in a multiply included header file. Otherwise you are going to violate the One Definition Rule principle.