[CRIU] [PATCH 14/23] cr: introduced the macro P() to convert an integer to unsigned long

Pavel Emelyanov xemul at parallels.com
Mon Jan 14 08:24:08 EST 2013


On 01/14/2013 04:02 PM, Alexander Kartashov wrote:
> On 01/14/2013 03:46 PM, Pavel Emelyanov wrote:
>> If we can fix this by using the standard %Lx (can we?) this is OK
> 
> If we use %Lx instead of %lx we will break x86 build.
> Consider the following program modelling our case:
> 
> #include <stdio.h>
> #include <inttypes.h>
> 
> int main() {
> uint64_t v;
> 
> v = 1;
> printf("%Lx\n", v);
> 
> return 0;
> }
> 
> Compilation fails on x86:
> 
> printf.c: In function ‘main’:
> printf.c:8:2: error: format ‘%Lx’ expects argument of type ‘long long 
> unsigned int’, but argument 2 has type ‘int64_t’ [-Werror=format]
> 
> while it succeeds on ARM.
> 


OK, then let's use the glibc's PRIx64 one. My previous objection was
about home-brew format specifier.


More information about the CRIU mailing list