[cs13001] iostream and cmath include files
Mikhail Nesterenko
mikhail at cs.kent.edu
Mon Sep 16 22:51:33 EDT 2013
CSI students,
During today's lecture, I showed an example where math functions, such
as squrt(), appeared to compile without
#include <cmath>
directive. As it turns out Microsoft's Visual Studio implements
"iostream" include file such that it itself includes "cmath". That is,
if you use Microsoft's Visual Studio and have
#include <iostream>
directive in your program, you implicitly include "cmath" as
well. This behavior is not a part of C++ standard, it does not work on
other platforms and you should not rely on it. That is, if you use
math functions make sure to include "cmath" include file.
Thanks,
--
Mikhail
More information about the cs13001
mailing list