Re: [PATCH 12/16] UML - Memory hotplug

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> +	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
-- 

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux