On Thursday 17 January 2008 11:51:49 pm Giacomo Catenazzi wrote:The restrict keyword controls aliasing, to be exact. And I'm skeptical that inserting const there would do anything at all. I must ask what relationship you think the const keyword has to compiler optimizations. I know of none, and I've yet to see that keyword cause any difference in the resulting assembly. It forces you to make your code clean and well-structured, but that's about it. Of course, it would be an interesting experiment to potentially redefine the const keyword to have stronger semantics, such as having the compiler assume that a function taking a const pointer argument will not modify the memory the pointer points to, and thus saving itself a memory load in the caller after the function executes, as long as the data is not global. I imagine that this would lead to some simple and measurable optimizations, all the while (this is where I get into hand-waving territory) breaking a minimum amount of code in current existence. But that is emphatically not how C is currently defined, and you're basically inventing an entirely new language... C2009 perhaps? :-) -- Vadim Lobanov --
| Greg Kroah-Hartman | [PATCH 005/196] Chinese: add translation of SubmittingDrivers |
| Linus Torvalds | Linux 2.6.25-rc4 |
| Bart Van Assche | Integration of SCST in the mainstream Linux kernel |
| Andrew Morton | 2.6.23-rc6-mm1 |
git: | |
| Arjan van de Ven | Re: [GIT]: Networking |
| Gerrit Renker | [PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side) |
| Andrew Morton | Re: [BUG] New Kernel Bugs |
| Radu Rendec | htb parallelism on multi-core platforms |
