vmiheer
vmiheer

Reputation: 148

Is there such thing as implicit declaration in c++?

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++?

Upvotes: 2

Views: 457

Answers (1)

Nicol Bolas
Nicol Bolas

Reputation: 473342

C++ does not allow implicit function declarations. Indeed, even C99/11 doesn't allow them. GCC compiles C by default as C89, which is why you got the error you did.

Upvotes: 4

Related Questions