Created on 2003-10-24.00:00:00 last changed 171 months ago
Rationale:
This is indeed a wart, but there is no good way to solve it. C doesn't provide a portable way of outputting the address of a function point either.
Given:
void f(int) {} void(*g)(int) = f; cout << g;
(with the expected #include and usings), the value printed is a rather surprising "true". Rather useless too.
The standard defines:
ostream& operator<<(ostream&, void*);
which picks up all data pointers and prints their hex value, but does not pick up function pointers because there is no default conversion from function pointer to void*. Absent that, we fall back to legacy conversions from C and the function pointer is converted to bool.
There should be an analogous inserter that prints the address of a function pointer.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-10-21 18:28:33 | admin | set | messages: + msg2637 |
2003-10-24 00:00:00 | admin | create |