0

I was burnt just now. I hadn't enabled warnings while compiling my c code. I was using atof without including stdlib.h. So the atof was using implicit declaration which had default return type of int. So the code wasn't working. I was wondering if the concept of implicit declarations also applies to c++?

4

1 回答 1

2

C++ 不允许隐式函数声明。事实上,即使是 C99/11 也不允许它们。GCC 默认将 C 编译为 C89,这就是您遇到错误的原因。

于 2017-10-21T05:16:32.993 回答