From C11 draft:
C11 (n1570), § K.3.5.1.1 The
tmpfile_sfunction
errno_t tmpfile_s(FILE * restrict * restrict streamptr);
What is the purpose of the restrict qualifier here?
Because there is no other parameters, the compiler is able to know that streamptr is not aliased without restrict, isn’t it?
There are several global variables around that have type
FILE*such asstdoutandstderrfor example. So the leftmostrestrictclearly indicates that none of these can be returned, the returnedFILE*doesn’t alias with any other. The secondrestrictmakes the same guarantee but one level higher, you are not allowed to pass something like&stderrin that function. (Wellstderris not necessarily a variable in the usual sense, but I hope you see the picture.)