Global restricted function pointer

T

Tim Rentsch

Keith Thompson said:
Perhaps I missed something among the masses of parentheses, but
I don't see a conversion back to the original type.

Here's the code in question:

| typedef void (*fp)();
|
| void run()
| {
| fp cb;
|
| cb = init;
| for (;;)
| cb = ((fp (*)())cb)();
| }

Now that I think about it, we haven't seen a declaration for init.
If init is either a function returning fp, or a pointer to such a
function, it might be ok.

In either case a cast would be needed to allow the assignment
to 'cb'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,815
Messages
2,569,702
Members
45,492
Latest member
juliuscaesar

Latest Threads

Top