Reputation: 17
I have a code
void(*updateFunc)(EW_Window*) = ((GlfwWindow*)wnd->wndData)->updateCallback;
if (updateFunc)
updateFunc(wnd);
And if (updateFunc)
always passes even updateFunc
is 0xcdcdcd (null in debugger).
What's going wrong and how I can fix it?
Upvotes: 0
Views: 105
Reputation: 310990
Do you mean
void(*updateFunc)(EW_Window*) = ((GlfwWindow*)wnd )->wndData->updateCallback;
Upvotes: 0
Reputation: 36401
0xcdcdcd
is not null-pointer, it is a pattern used to mark unitialized memory. That value is considered as a true
value in C. The problem is that ((GlfwWindow*)wnd->wndData)->updateCallback
has a wrong value...
Upvotes: 3