View Single Post
Old 09-11-2007, 08:54 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,720
redhead is on a distinguished road
To quote Peter's notes
Quote:
The first method is with an implicit conversion to pointer:
Code:
       funcptr = f;
The second method is with an explicit manufacture of a pointer:
Code:
       funcptr = &f;
Both ways are completely equivalent (AFAIK) and completely legal. You might think that the explicit method is more consistent because it's analogous to how we get the address of objects. However, the first method is shorter and cleaner. It's up to you.
And to widen the explanation with some wise words from The C++ Tutorial
Quote:
The implicit dereference method looks just like a normal function call — which is what you’d expect, since normal function names are pointers to functions anyway! However, some older compilers do not support the implicit dereference method, but all modern compilers should.
So there you have it, they are the same, however, some older compilers wont support implicit dereferencing.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote