Reputation: 1243
While programming, it is common to forget to include a header and thereby call an undefined function. Calling a function that is not defined in the caller's namespace is not, according to gcc or clang with default options, a compile-time error. Rather, a warning, "implicit declaration of function __ is invalid in C99" is issued. Why categorize this as anything but an error? Have you every seen any cool implicit function hacks?
Upvotes: 3
Views: 227
Reputation: 122383
Implicit function declaration is a feature that is valid in older version of C. The compiler has no reason to reject such valid code, but it's kind enough to give a warning since it's a feature that isn't supported since C99.
Throwing error in such cases would be incorrect, as there are many legacy code that the compiler must consider. It doesn't mean implicit function declaration has any cool hacks.
Upvotes: 1