Hello Guest

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

  • 4 Replies
  • 842 Views
Hello. In the getting started tutorial available here : https://www.lwjgl.org/guide

Line 50 is the following,
Code: [Select]
if ( window == NULL )
But the variable window is declared as a primitive long in Line 17,
Code: [Select]
    private long window;
A primitive long can never be null. So is this a mistake in line 50?

-

*

Offline KaiHH

  • ***
  • 161
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
« Last Edit: May 22, 2018, 07:23:44 by KaiHH »

Oh I see. Thank you. It's a bit confusing though.

*

Offline KaiHH

  • ***
  • 161
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.

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