Skip to content

Instantly share code, notes, and snippets.

@mkropat
Created January 29, 2021 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkropat/51eb102fa318f274de2a36048b65ad30 to your computer and use it in GitHub Desktop.
Save mkropat/51eb102fa318f274de2a36048b65ad30 to your computer and use it in GitHub Desktop.
// gcc -I$JAVA_HOME/include -I$JAVA_HOME/include/linux jsizes.c -o jsizes && ./jsizes
#include <stdio.h>
#include <jni.h>
int main() {
printf("jboolean %li\n", sizeof (jboolean));
printf("jbyte %li\n", sizeof (jbyte));
printf("jchar %li\n", sizeof (jchar));
printf("jshort %li\n", sizeof (jshort));
printf("jint %li\n", sizeof (jint));
printf("jlong %li\n", sizeof (jlong));
printf("jfloat %li\n", sizeof (jfloat));
printf("jdouble %li\n", sizeof (jdouble));
printf("jsize %li\n", sizeof (jsize));
printf("\n");
printf("unsigned char %li\n", sizeof(unsigned char));
printf("unsigned short %li\n", sizeof(unsigned short));
printf("unsigned int %li\n", sizeof(unsigned int));
printf("unsigned long %li\n", sizeof(unsigned long));
printf("unsigned long long %li\n", sizeof(unsigned long long));
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment