Hello, i tried an example on wiki and with gcc it just works but zcc gives a big error
it seems to fail on ' 1u ' a part of the line:
putchar(x & (1u << i) ? '1' : '0');
#include <stdio.h>
int main() {
unsigned char a = 0, b = 0, c = 0;
scanf("%hhu", &a);
printf("a = %hhu, b = %hhu, c = %hhu\n", a, b, c);
scanf("%hhu", &b);
printf("a = %hhu, b = %hhu, c = %hhu\n", a, b, c);
scanf("%hhu", &c);
printf("a = %hhu, b = %hhu, c = %hhu\n", a, b, c);
return 0;
}
Yes, it looks like %hh processing is missing, I can add it with probably only a cost of 10-20 bytes or so. However it's really not need since for the call to printf, sizeof(char) == sizeof(short) == sizeof(int), that is everything smaller is promoted to a 16 bit integer.
dom wrote: ↑Mon Apr 12, 2021 7:45 amYes, it looks like %hh processing is missing, I can add it with probably only a cost of 10-20 bytes or so. However it's really not need since for the call to printf, sizeof(char) == sizeof(short) == sizeof(int), that is everything smaller is promoted to a 16 bit integer.
It took 8 bytes in the end. The nightly or 2021-04-13 will have it in.