Unfortunately, the g++ compiler did compile this piece of code because 'j1' is defined as a Bessel function in 'cmath'. But why is it defined although I don't include the whole namespace?
E:\Users\MiiNiPaa\home\Developement\CodeBlocks\projects\Test\main.cpp|6|error: 'j1' was not declared in this scope|
For me everything in cmath in std namespace.
And even if it was in global, you should write if(j1()>0) to actually call function. Maybe j1 is a global variable somewhere?
"Unfortunately, the g++ compiler did compile this piece of code because 'j1' is defined as a Bessel function in 'cmath'."
No, the "std" name-space does not have a function called "j1" -- unless your compiler has defined a function call "j1" somewhere inside its implementation. Sometimes, the compiler is able to define functions that are accessible in every scope; "__builtin_...( )" is an example of one of those functions.
The thing is that I never use this stupid Bessel functions nor do I link to any libaries! It seems to be more of a g++ issue. Any hints how I can make sure to use only the standard declarations?
I guess I should close this thread. Thank you for your time :)
Edit: At least I will get a message, if I use the '-Wall' flag.
...$ g++ -Wall -pedantic -ansi wtf.cpp
wtf.cpp: In function ‘int main()’:
wtf.cpp:8:7: warning: the address of ‘double j1(double)’ will always evaluate as ‘true’ [-Waddress]