[Peter Samuelson]
> > Is this similar to the gcc 'const' attribute?
> > 
> >   int foo (int, char *) __attribute__((__const__));
> > 
> > This is valid in GNU C (not just C++).  Read the info page for
> > details.

[Eray Ozkural]
> Probably, I haven't used it in my C code though. I've found an
> article explaining the C9x restrict keyword at URL
> 
> http://www.cuj.com/archive/1707/feature.html

OK, it appears your 'restrict' keyword has *nothing* to do with
"constant functions" as gcc implements them.  'restrict' is all about
pointers not being aliased.  A gcc constant function, OTOH, is one
guaranteed not to have any side effects, so its return value can be
cached and reused by the optimizer.  Two completely different things.

And I have no idea if gcc implements 'restrict' or not.  As of 2.95 it
does do type-based alias optimizing, so I imagine at least a lot of the
infrastructure is there.

Peter
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
Please read the FAQ at http://www.tux.org/lkml/

Reply via email to