tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: C restrict type qualifier



On Thu, Jan 14, 2010 at 01:19:12PM +0000, Sad Clouds wrote:
> Does anyone know if it is OK to use 'restrict' type qualifier with
> pointers to constant value, which may overlap in memory, eg.
> 
> my_function(const void * restrict ptr1, const void * restrict ptr2)

restrict doesn't care about const. With restrict you are basically
saying that changes to the underlaying memory must go over the pointer.
As long as the memory referenced by ptr1 and ptr2 is not changed, that
is fine. E.g. as long as nothing changes the memory via a third
reference.

Joerg


Home | Main Index | Thread Index | Old Index