lkml.org 
[lkml]   [2008]   [Jan]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Why is the kfree() argument const?
From
Date

On Fri, 2008-01-18 at 11:14 -0800, Vadim Lobanov wrote:
[cut]
> 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.

This is why GCC has the pure and const function attributes. These
attributes are more powerful than the "const" keyword, and do allow
optimizations with assumptions about global state.
--
Zan Lynx <zlynx@acm.org>
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2008-01-18 20:33    [W:0.052 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site