Correct way to set a ContactProcessed callback?

Sly
Posts: 16
Joined: Wed Apr 23, 2008 9:57 am

Correct way to set a ContactProcessed callback?

Post by Sly »

Is this the correct way to set a contact processed callback, or is there a proper function to set it?

extern ContactProcessedCallback gContactProcessedCallback;
gContactProcessedCallback = MyContactProcessedCallback;
Wavesonics
Posts: 71
Joined: Thu May 22, 2008 8:03 pm

Re: Correct way to set a ContactProcessed callback?

Post by Wavesonics »

that will work but the more correct way of doing it is:

gContactProcessedCallback = &MyContactProcessedCallback;

Notice the address operator there to explicitly specify that you are assigning the address to a pointer.
Sly
Posts: 16
Joined: Wed Apr 23, 2008 9:57 am

Re: Correct way to set a ContactProcessed callback?

Post by Sly »

Aside from the debatable semantics of passing a pointer to a function, that is the correct way?
Wavesonics
Posts: 71
Joined: Thu May 22, 2008 8:03 pm

Re: Correct way to set a ContactProcessed callback?

Post by Wavesonics »

yes.