Re: [PATCH] NTFS: Change string pointers to string constants.

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

 



On Tue, 2009-12-08 at 00:57 +0000, Anton Altaparmakov wrote:
> Can you please explain the rational for making this change?

Perhaps it's not worth much, but it saves a pointer reference.

$ cat pointer.c
#include <string.h>
#include <stdio.h>

int main (int argc, char** argv)
{
	static const char *foo = "abcdefg";
	printf("%s\n", foo);
	return 0;
}

$ gcc -c pointer.c
$ size pointer.o
   text	   data	    bss	    dec	    hex	filename
     37	      4	      0	     41	     29	pointer.o

$ cat reference.c
#include <string.h>
#include <stdio.h>

int main (int argc, char** argv)
{
static const char foo[] = "abcdefg";
printf("%s\n", foo);
return 0;
}

$ gcc -c reference.c
$ size reference.o
   text    data     bss     dec     hex filename
     36       0       0      36      24 reference.o



--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux