Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The meaning of "inline" differs between C and C++.

Quote from the gcc manual:

"GCC implements three different semantics of declaring a function inline. One is available with -std=gnu89 or -fgnu89-inline or when gnu_inline attribute is present on all inline declarations, another when -std=c99, -std=gnu99 or an option for a later C version is used (without -fgnu89-inline), and the third is used when compiling C++."

Nevertheless, "static inline" means the same thing in all 3 standards, unlike "inline" alone.

This can be a reason to always prefer "static inline", because then it does not matter whether the program is compiled as C or as C++.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: