On Sat, Mar 25, 2006 at 08:26:08PM +0100, Jan Engelhardt wrote:
> 
> >> +  char buf[sizeof("18446744073709551615\0")];
> 
> And this one seems wrong[*] to me too (making it a rofl??).
> It is two chars (or one[*]) too long.

One - it needs to be NULL-terminated.
> 
> Consider this test:
> 
>       #include <stdio.h>
>       #include <string.h>
>       int main(void) {
>           printf("%d\n", sizeof("18446744073709551615\0"));
>           printf("%d\n", sizeof("18446744073709551615"));
>           printf("%d\n", strlen("18446744073709551615"));
>       }
> 
> Which will print, when executed,
> 
>       22
>       21
>       20      (the "pure string" length)
> 

Oops, I was basing this on a hazy (too hazy, apparently) recollection
that the C standard specified sizeof("literal string") as being the
pure string length.  Now that I'm actually thinking about it, the
actual behavior makes much more sense.

Thanks for checking this out in time for me to fix it in my revised
patch.

                                Jeff


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

Reply via email to