Adding '-Werror' and/or '-Wall' - I have no recollection of which works, GCC will usually warn when the incorrect format for the variable is given and, best of all, tells you what it should be -And that also justifies why "%llu", though I am not sure why C couldn't have adopted "%u64" or something similar, even a full "%uint64_t".
Code:
/home/pi/mypico/timing/timing.c:25:20: error: format '%u' expects argument of type 'unsigned int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'} [-Werror=format=] 25 | printf("%u\n", time_us_64()); | ~^ ~~~~~~~~~~~~ | | | | | uint64_t {aka long long unsigned int} | unsigned int | %llu
Statistics: Posted by hippy — Wed Jan 01, 2025 7:49 pm