I have the same problem as Shinji. Maybe we're using the same book (I'm using "Learn to program with C++", written by John Smiley)?
The compiler doesn't give a compile-error, but a warning:
"[Warning] the address of 'void Dummy()', will always evaluate as 'true'"
This warning is referring to the line where "&Dummy" is written.
And indeed, when you run the program the number "1" (=true) is printed.
The problem gets worse when you actually assign the address-location to a pointer-variable (that you declare as integer).
1 2
|
int* pDummy=0;
pDummy=&Dummy;
|
Then you get this compile-error:
"cannot convert 'void(*)()' to 'int*' in assignement"
Of course, due to the fact that the address of the function will evaluate as true, this address cannot be stored in the integer pointer-variable (bool *pDummy works fine).
I just don't get it. The address is supposed to be hexadecimal. Or is this a fault of the writer John Smiley?