|
-
March 4th, 2008, 01:19 AM
#7
Re: Function pointers...I don't know what they are
My own knowledge of function pointers is limited, but I'm fairly certain that in some cases you'd have to write:
I'm not sure if that's a compiler thing, or a C-vs-C++ thing, or what.
For both C and C++, both (*pfunc)(10) and pfunc(10) are legal.
But I definitely recall seeing that as the preferred way.
The above is certainly cleaner, though. Almost what you'd expect from a language that supports functions as first-class objects, like one of the ML variants.
I prefer the pfunc(10) version: if you substitute the function pointer with a function object, the code need not change.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|