Messages in this thread | | | Date | Fri, 9 Feb 2007 13:27:01 +0100 (MET) | From | Jan Engelhardt <> | Subject | Re: -mm merge plans for 2.6.21 |
| |
On Feb 9 2007 14:04, Andi Kleen wrote: >Andrew Morton <akpm@linux-foundation.org> writes: >> >> As long as nobody takes the address of them (which wouldn't compile today >> anyway) then the compiler should be able to not allocate store for these. > >This would only work for unit-at-a-time compilers (if it works at all, >i'm not sure), but not older 3.x compilers > >> That they're const might help too. > >Don't think it does.
GCC 4.1 optimizes both Andrew's and Frederik Deweerdt's ideas perfectly out. Even if the const was not there in Frederik's example, gcc seems throw it out with -O2 (judging by `nm` output) since it is 1. static 2. unused. Gcc even gives out a warning that the item is unused when not marked with const.
Jan -- ft: http://freshmeat.net/p/chaostables/ - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |