samedi 4 avril 2015

The following program compiles correctly:



#include <algorithm>

int main(int argc, char *argv[]) {

return int(log(23.f));

}


(under g++ 4.9.2 with the flag -std=c++11)


The code uses the function log, which is defined on <cmath>. However, it does not include the header <cmath>, only the header <algorithm>. Why is it that g++ doesn't give any warnings, and compiles the code correctly?


Aucun commentaire:

Enregistrer un commentaire