On Friday 18 January 2008 05:54:12 am Andy Lutomirski wrote:That's absolutely not true. Let's unravel the code, by fixing usage of 'x' (which seems to vary at will between value and pointer in the above example), and by replacing printf with another opaque function. Our decls: void foo(const int *ptr); void bar(int val); You're saying that this: foo(&x); bar(x); can be reordered into this: bar(x); foo(&x); No way. First, the way that const is currently defined, the compiler cannot assume that the value of x did not change while foo was executing. So, it will not only be forced to leave the two functions in that order, it will even reload the value of x before passing it into bar. Go figure. Second, even if const did have stronger semantics that forbade the value of x from being modified during execution of foo, the compiler still could not reorder the two function calls, before it cannot assume that the two functions (in their internal implementations) do not touch some other, unknown to this code, global variable. -- Vadim Lobanov --
| James Bottomley | Re: Integration of SCST in the mainstream Linux kernel |
| Greg Kroah-Hartman | [PATCH 005/196] Chinese: add translation of SubmittingDrivers |
| majkls | sys_chroot+sys_fchdir Fix |
| Paul Mackerras | Re: [linux-pm] [PATCH] Remove process freezer from suspend to RAM pathway |
git: | |
| Jarek Poplawski | [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| David Miller | [GIT]: Networking |
| KOSAKI Motohiro | [bug?] tg3: Failed to load firmware "tigon/tg3_tso.bin" |
