It seems on some software/compilers the pow()
function works without any math libraries at all. Only with <iostream>
. But in others it complains. Have math functions been added to the <iostream>
library or to some other place?
Headers can - and often do - include other headers. Standard library headers are no exception to this.
Even though you chose not to include a header (let's name it a
) that you depended on, it's possible that the header happened to be included by another header (let's name it b
) that you did include. In that case, your program is not guaranteed to continue working if the b
header is ever modified to not include a
. That is why you must always include all headers that you depend on - even when your program appears to work without including some of them.
All different versions of different implementations of standard library are different and therefore a
in one version could include b
while a
in another version could just as well not include b
. Same applies to all API that have multiple versions of implementations.