What is the role of declaration of implicit functions in c / C ++, if any?

When programming, they usually forget to include the header and thereby call the undefined function. Calling a function that is not defined in the caller's namespace, according to gcc or clang with default parameters, is not a compile-time error. Rather, a warning is issued, "an implicit function declaration __ is not valid in C99." Why classify it as anything but an error? Have you ever seen any interesting implicit hack functions?

+4
source share
1 answer

Declaring an implicit function is a function that is valid in the older version of C. The compiler has no reason to reject such valid code, but it is kind enough to give a warning, because it is a function that is not supported with C99.

A throw error in such cases would be incorrect, since there is a lot of outdated code that the compiler should consider. This does not mean that the implicit function declaration has cool hacks.

+1
source

Source: https://habr.com/ru/post/1525359/


All Articles