lkml.org 
[lkml]   [2000]   [Oct]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [Criticism] On the discussion about C++ modules

[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 majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 12:41    [W:0.299 / U:44.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site