From: Garrett C. <yan...@gm...> - 2009-12-19 05:23:42
|
2009/12/18 Jiří Paleček <jpa...@we...>: > Hello, > > in your patch from 4.11., "1. Use linux_syscall_numbers.h. 2. Fix a format > string (use inttypes.h)....", there is: > > > @@ -174,7 +177,7 @@ void test_mbind(void) > ret = 1; > return; > } > - printf("%lx\n", addr); > + printf("%" __PRI64_PREFIX "x\n", (long) addr); > ret = mbind(addr, len, MPOL_BIND, &mask, 8 * sizeof(mask), 0); > } > > I am not happy with that, particularly: > > 1. You use a 64-bit format specifier, but pass a long. A long may not be > 64-bit, in which case the code is buggy. > > 2. You use __PRI64_PREFIX, which, as all underscore-prefixed names is an > implementation detail of the library. > > 3. Why didn't use just printf("%p\n", addr), when addr is a void* and "p" is > a format specifier for pointers. I just accidentally committed the -> "%p" change a second ago. Thanks for the keen eye on the style and functional points Jiri! Learned something new today :]. Thanks, -Garrett |