mercredi 27 août 2014

Is Visual Studio buggy in printing the function address?


Vote count:

1




Take the following testcase:



#include <iostream>

void foo()
{}

int main()
{
std::cout << &foo << std::endl;
}


GCC 4.1.2, GCC 4.8 and GCC 4.9 (C++03 and C++11) all give the following output when building and then compiling:



$ g++ main.cpp -o test && ./test
main.cpp: In function 'int main()':
main.cpp:8:23: warning: the address of 'void foo()' will always evaluate as 'true' [-Waddress]
std::cout << &foo << std::endl;
^
1


However, Microsoft Visual Studio 2012 and 2013 output a pointer address instead.


Which set of toolchains is conformant? And is the non-conformance documented anywhere?



asked 4 mins ago







Is Visual Studio buggy in printing the function address?

Aucun commentaire:

Enregistrer un commentaire