On Fri, 23 Oct 2020, Vivien Kraus wrote:
Is it not possible to always use "%lld" and always convert the
arguments to (long long int)?
The way I have been doing things for many years is to get the size of 
the underlying type and then include a cast in the printf arguments to 
a type of the same size.  The need to add a cast is a bit messy, but 
then then again, just about everything related to printf is messy.
So create a define for the time_t formatter, and a define/typedef for 
the type to cast to.
The approach that Paul Eggert suggests is very interesting, but it 
might not provide absolute proof of the C type since the 
compiler/linker might allow success if the types are the same size.  A 
printf syntax checker might not use the same rules.
Anything involving executing code should be avoided as much as 
possible since it hurts cross compilation.
Anything involving recent C standards should be avoided since it harms 
portability.
Bob
--
Bob Friesenhahn
bfrie...@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/
Public Key,     http://www.simplesystems.org/users/bfriesen/public-key.txt

Reply via email to