Free strings returned by XGetAtomName to avoid leakage.

Call XFree() on the string returned by XGetAtomName() in the Linux part of the Shell to avoid a memory leak.
Technically, NULL is not part of the language, its part of the OS related defines.  You should be using nullptr in modern C++ (C++11), but since we don’t use C++11 across the board, NULL is the define to use for compatibility between various dialects.  Using NULL shows your intent properly.

As for the warnings, I thought LLVM complained about it but it doesn’t appear to do so.

In relation to libRocket, libRocket uses NULL, not 0 to represent an invalid pointer.

For reference, and this doesn’t apply to libRocket directly:
Not all OSes consider NULL to be 0 (very old ones)
Common OSes protect page 0 so you’ll get an signal/exception for trying to dereference a 0 based pointer, thats not true of all environments, especially those that do not have a MMU so there is no way to protect memory at address 0 so you will get weird unexpected behavior.  Arduino for instance, will not have any problem trying to dereference a 0’d pointer

On Jun 17, 2014, at 2:39 PM, Lars Pensjö <notifications@github.com> wrote:

> In Samples/shell/src/x11/ShellX11.cpp:
> 
> > @@ -198,6 +198,7 @@ void Shell::EventLoop(ShellIdleFunction idle_function)
> >  		while (XPending(display) > 0)
> >  		{
> >  			XEvent event;
> > +			char *event_type = 0;
> Isn't it always allowed to assign 0 to a pointer in C++? That is, I don't understand why it would generate a warning.
> 
> —
> Reply to this email directly or view it on GitHub.
>