Messages in this thread | | | Date | Sat, 25 Mar 2006 20:26:08 +0100 (MET) | From | Jan Engelhardt <> | Subject | Re: [PATCH 12/16] UML - Memory hotplug |
| |
>> + 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 --
| |