Quote Originally Posted by laserlight View Post
There is no need for a cast in the first place, since a pointer to the non-template version of tolower as borrowed from the C standard library is already of type int (*)(int).
Yes, it is, but there is a problem when we use this name in transform function in g++:

Code:
#include <algorithm>
#include <string>
#include <cctype>
using namespace std;

int main()
{
    string a;
    transform(a.begin(), a.end(),
              a.begin(), tolower);
}
We're getting the following error:

error: no matching function for call to 'transform(__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,
__gnu_cxx::__normal_iterator<char*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > >,
<unresolved overloaded function type>)'
Quote Originally Posted by laserlight View Post
But if it was not... I do not think that such function pointer conversions are well defined.
Why do you think so ? Comeau C++ Online doesn't show any errors in the example with reinterpret_cast operator...