public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] Patch from 4.11.
@ 2009-12-19  2:06 Jiří Paleček
  2009-12-19  5:23 ` Garrett Cooper
  0 siblings, 1 reply; 2+ messages in thread
From: Jiří Paleček @ 2009-12-19  2:06 UTC (permalink / raw)
  To: Garrett Cooper; +Cc: ltp-list@lists.sourceforge.net

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.

Regards
     Jiri Palecek

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [LTP] Patch from 4.11.
  2009-12-19  2:06 [LTP] Patch from 4.11 Jiří Paleček
@ 2009-12-19  5:23 ` Garrett Cooper
  0 siblings, 0 replies; 2+ messages in thread
From: Garrett Cooper @ 2009-12-19  5:23 UTC (permalink / raw)
  To: Jiří Paleček; +Cc: ltp-list@lists.sourceforge.net

2009/12/18 Jiří Paleček <jpalecek@web.de>:
> 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

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-12-19  5:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-19  2:06 [LTP] Patch from 4.11 Jiří Paleček
2009-12-19  5:23 ` Garrett Cooper

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox