Kyl*_*mus 4 c c++ compiler-construction
我们公司的所有申请人必须通过一个简单的测验,使用C作为早期筛选过程的一部分.
它由C源文件组成,必须对其进行修改才能提供所需的功能.我们明确声明我们将尝试按原样编译文件,不做任何更改.
几乎所有申请人都使用"strlen",但其中一半不包含"string.h",因此在我包含它之前它不会编译.
它们只是懒惰还是那些不需要您包含标准库文件的编译器,例如"string.h"?
Wer*_*sey 13
GCC将很乐意按原样编译以下代码:
main()
{
printf("%u\n",strlen("Hello world"));
}
Run Code Online (Sandbox Code Playgroud)
它会抱怨incompatible implicit declaration of built-in function ‘printf’和strlen(),但它仍会产生可执行文件.
如果用-Werror它编译就不会编译.