86_memory-model.c 773 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #include <stdio.h>
  2. int
  3. main()
  4. {
  5. #if defined(__LLP64__)
  6. if (sizeof(short) == 2
  7. && sizeof(int) == 4
  8. && sizeof(long int) == 4
  9. && sizeof(long long int) == 8
  10. && sizeof(void*) == 8) {
  11. (void)printf("Ok\n");
  12. } else {
  13. (void)printf("KO __LLP64__\n");
  14. }
  15. #elif defined(__LP64__)
  16. if (sizeof(short) == 2
  17. && sizeof(int) == 4
  18. && sizeof(long int) == 8
  19. && sizeof(long long int) == 8
  20. && sizeof(void*) == 8) {
  21. (void)printf("Ok\n");
  22. } else {
  23. (void)printf("KO __LP64__\n");
  24. }
  25. #elif defined(__ILP32__)
  26. if (sizeof(short) == 2
  27. && sizeof(int) == 4
  28. && sizeof(long int) == 4
  29. && sizeof(void*) == 4) {
  30. (void)printf("Ok\n");
  31. } else {
  32. (void)printf("KO __ILP32__\n");
  33. }
  34. #else
  35. (void)printf("KO no __*LP*__ defined.\n");
  36. #endif
  37. }