Hi skeeto,
Probably late to the party here, but I was reading https://nullprogram.com/blog/2021/08/21/ but I found your test program overly complex.
You could reduce it to the following one-liner:
```c
#include <stdio.h>
#include <limits.h>
int main(void) {
return printf("%d-bit, %s-endian\n",
sizeof(void*)*CHAR_BIT, *(char*)(int[]){1}?"little":"big");
}
```
--
Jeffrey H. Johnson
trnsz@pobox.com
#include <stdio.h>
#include <limits.h>
int main(void) {
int n; n = 1;
return printf("%lu-bit, %s-endian\n",
sizeof(void*)*CHAR_BIT, *((char*)&n)?"little":"big");
}
… might be better, compatible with C89.
--
Jeffrey H. Johnson
trnsz@pobox.com