Bob
Bob

Reputation: 177

Using a function without callback C++

I want to call a function which requires a callback:

cookie_monster->SetCookieWithOptionsAsync(
   ext_url, "dummy=value", options, &callback_function));

What do I do if I don't want to call any callback function? Is there something like set NULL?

cookie_monster->SetCookieWithOptionsAsync(
   ext_url, "dummy=value", options, NULL);

Upvotes: 0

Views: 143

Answers (1)

Mahmoud Al-Qudsi
Mahmoud Al-Qudsi

Reputation: 29579

It depends on the function. If, in the body of the function, the code tests whether or not callback_function is NULL before calling it, you'll be OK. Otherwise, you'll have a segfault and your program will crash.

In that case, you'll need to pass in an empty/do-nothing callback to accomodate the API.

Upvotes: 4

Related Questions