Re: [Criticism] On the discussion about C++ modules

From: Peter Samuelson (peter@cadcamlab.org)
Date: Tue Oct 17 2000 - 06:22:14 EST


  [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/



This archive was generated by hypermail 2b29 : Mon Oct 23 2000 - 21:00:11 EST