| 
  | 
Vincent Le Chevalier wrote:
> John VanSickle a écrit :
>> Invisible wrote:
>>> Can somebody interpret this for me?
>>>
>>>   while (TRUE) { cont = (*cont)(); }
>>>
>>> What on earth...?
>>
>> cont is a pointer to a function that is expected to return a pointer 
>> to a function.  The code here causes a series of functions to be 
>> called, each one specifying another function to be called afterwards 
>> by returning the address of the function to be called.
> 
> I was thinking the same, but I can't seem to find the right type 
> definition to make it work without casting to and from void*... Which is 
> apparently illegal 
> (http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.8)
Casting back and forth from void* is considered exceptionally unwise in 
C++, but it's considered a great way of writing tighter code in C.
Regards,
John
 Post a reply to this message 
 | 
  |