Grum Report post Posted March 26, 2005 set_window_handler (chat_win, ELW_HANDLER_DISPLAY, &display_chat_handler); Ok, a stupid question, but it's been bugging me: why &display_chat_handler, and is it even correct? I'd think that display_chat_handler by itself is by definition an address, and that the only reason it works is that & on a fixed address returns the address itself. Is that correct, or am I missing something? [NOTE: the line above I added myself, but it's analogous to other calls to set_window_handler () in the code] Share this post Link to post Share on other sites
crusadingknight Report post Posted March 27, 2005 I believe, if my memory of K&R's "The C Programming Language" is correct, is that a function is represented as the same way as a normal variable, ie. the name representing the function, parens only used for calls. Because of this identical representation, we use & on our function/pseudo-variable to return the address. Share this post Link to post Share on other sites
Leeloo Report post Posted March 27, 2005 I believe, if my memory of K&R's "The C Programming Language" is correct, is that a function is represented as the same way as a normal variable, ie. the name representing the function, parens only used for calls. Because of this identical representation, we use & on our function/pseudo-variable to return the address. Erm, then what do you use the name without () or & for? Assigning a value to the function? Share this post Link to post Share on other sites
Wytter Report post Posted March 27, 2005 void *set_window_handler(int win_id, int handler_id, int (*handler)() ); So you can use both declarations. As you say functions are already memory addresses - the memory address is even absolute; hereby follows that &window_handler == window_handler. Share this post Link to post Share on other sites