[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: restrict qualifier with pointer to a pointer
On Tue, 16 Feb 2010 01:55:17 +0000
Sad Clouds <cryintothebluesky%googlemail.com@localhost> wrote:
> I've been looking at various articles, but can't seem to find the
> right answer. How do people use C99 restrict qualifier with a pointer
> to a pointer data type.
> void do_stuff(struct numbers **n);
> How do I tell compiler that function parameter 'n' is the only pointer
> with which function can access fields inside the structure?
> void do_stuff(struct numbers ** restrict n);
> void do_stuff(struct numbers * restrict *n);
> void do_stuff(struct numbers * restrict * restrict n);
Well after digging around I found the following extract:
So I think the right way to declare function prototype would be:
void do_stuff(struct numbers * restrict * restrict n);
which basically says the first indirection pointer is of 'restrict'
type and the second indirection pointer is of 'restrict' type too, i.e.
both of these pointers point to distinct memory addresses and do not
alias within that function.
Main Index |
Thread Index |