How do you write code to compile cross-platform without warnings. For example, I don't get warnings on x64 platform, but I do on ARM (raspberry PI):
warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 5 has type ‘size_t {aka unsigned int}
Needless to say I don't want to disable warnings.
More examples and scenarios:
warning: format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 5 has type ‘uint64_t {aka long long unsigned int}’
uint64_t Created; // 8 bytes
time_t now = time(NULL);
"Current time: %li sec, %lu nanosecs", now, msg.Created
size_t is probably the highest offender:
Basic use of sizeof:
warning: format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 4 has type ‘unsigned int’
tr_debug("pbJobs size: %lu", sizeof(pbJobs));
tr_debug is equivalent of printf for Mbed OS platform. Yes, I compile on Mbed OS and Linux.