Optimizing

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

 



Consider the following code:

----
#define SRC "Big blob of text goes here"

extern int foo(int, const void*, int);

void f1(void) {
        foo(1, SRC, sizeof(SRC) - 1);
}

void f2(void) {
        char buf[sizeof(SRC) - 1];
        __builtin_memcpy(buf, SRC, sizeof(SRC)  - 1); 
        foo(1, buf, sizeof(SRC) - 1);
}
----

Is it a valid optimization for the compiler to generate the same
instructions for f2 as it generates for f1?

Would it be hard to make GCC do it?

/MF



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux