I'm trying to understand this function and convert it to ctypes:
15 XDisplay* GetXDisplay() {
16 static XDisplay* display = NULL;
17 if (!display)
18 display = OpenNewXDisplay();
19 return display;
20 }
We see here if(!display)
then do display = OpenNewXDisplay();
but what confuses me is the guy defines on the line above it that display
is NULL
(static XDisplay* display = NULL;
) so why on earth the need for the if, if he just set it to null? Is display a global variable somehow?