
Yuriy Taraday wrote:
Oh, we didn't mention this function before. I'm curious why "const jobject&"? jobject - just a pointer and constant referencing to a pointer looks pointless.
[...]
//! Returns a pointer to the C++ object wrapped by \p ppl_object. void* get_ptr(JNIEnv* env, const jobject& ppl_object);
I guess that, since we are not JNI experts, we just tried to take a safer approach whereby the `jobject' datatype is treated as a black box.
Usually, when we need to pass a "black box" datatype as an argument, we pass it by reference; since we do not need to modify it in this function, we also qualify it using const.
I just realized that we haven't been fully systematic in this respect, since we also have the helper function
//! Returns \c true if and only if \p obj is a null Java reference. jboolean is_null(JNIEnv* env, jobject obj);
which is passing its jobject argument by copy.
Cheers, Enea Zaffanella.