title: Is it safe to cast jlong to long?
body: <p>I'm developing a native plugin for Android with JNI in C++. I want to print out a <code>jlong</code> value, which is <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/types.html" rel="nofollow noreferrer">defined as a 64-bit value</a>. Is it safe to cast it directly to a long, or are there any platform-specific issues I should be aware of?</p>
  
  <pre><code>jlong foo = 2;
  
  // This results in the following warning:
  // Format specifier '%ld' requires 'long' argument instead of 'jlong'.
  printf("%ld", foo);
  
  // This works without a warning.
  printf("%ld", (long)foo);
  </code></pre>