Error in the getting started tutorial: window(long) is being compared to Null.

Started by iamcreasy, May 22, 2018, 05:10:05

Previous topic - Next topic

iamcreasy

Hello. In the getting started tutorial available here : https://www.lwjgl.org/guide

Line 50 is the following,
if ( window == NULL )


But the variable window is declared as a primitive long in Line 17,
    private long window;


A primitive long can never be null. So is this a mistake in line 50?

-

KaiHH

NULL is not null. NULL instead is defined as a static field whose type is long and value is 0. It should resemble http://en.cppreference.com/w/cpp/types/NULL

iamcreasy


KaiHH

For a Java developer, maybe. But it shows that LWJGL also tries to attract C/C++ developers to the JVM platform by making it easy to adapt the vast amounts of familiar C/C++ OpenGL/GLFW examples/tutorials to the JVM/Java. It is (almost) really only copy and paste.

iamcreasy

Hmm, didn't think of it in that way. Interesting observation. Thank you.