Re: [PATCH 12/16] UML - Memory hotplug
From: Jan Engelhardt
Date: Sat Mar 25 2006 - 14:25:00 EST
>> + char buf[sizeof("18446744073709551615\0")];
>
>rofl. We really ought to have a #define for "this architecture's maximum
>length of an asciified int/long/s32/s64". Generally people do
>guess-and-giggle-plus-20%, or they just get it wrong.
And this one seems wrong[*] to me too (making it a roflÂ).
It is two chars (or one[*]) too long.
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)
[*] Depending on what the original author wanted.
Jan Engelhardt
--