I was interested to know if there is any process already in place to check variables when printing them using printf or wprintw.
Here is the scenario. There are variables being changed and altered in another thread. Then in another thread wprintw prints the contents of the variable to the screen terminal concurrently. Sometime the program segfaults randomly.
A hack (although I'm not sure if actually works) is to do a check like so:
Code:
wprintw(window, "%d\n", X ? X : 0);
Check if X is valid, but if not then output 0 instead.
Is this really necessary? Does this just test if X == 0 or does it test if X is an int?
Any knowledge greatly appreciated.