Pointless use of restrict
Tim Prince
n8tm@aol.com
Mon Aug 17 13:38:00 GMT 2009
Marcus Clyne wrote:
> Hi,
>
> Am I right in saying that defining a function like
>
> func_name (my_type_t * __restrict);
>
> is pointless, because there are no other pointers that the pointer could
> overlap with?
>
Maybe, if there are no global variables.
However, __restrict appears to be a BSD version of C99 restrict or gcc
__restrict__
> Can anyone explain what GCC does differently for the two following
> definitions:
>
> func1 (my_type_t * __restrict, my_type_t *__restrict);
>
> AND
>
> func2 (my_type_t *, my_type_t *);
>
> ?
>
You may need an example relevant to your own usage, where you could
discover (perhaps by -S or other enabled phase output) what those
differences are. One of the more common uses of * restrict is to enable
auto-vectorization.
More information about the Gcc-help
mailing list