Roger Oberholtzer wrote:
On Fri, Jun 15, 2018 at 11:00 AM, Per Jessen <per@computer.org> wrote:
Roger Oberholtzer wrote:
On Fri, Jun 15, 2018 at 8:20 AM, Per Jessen <per@computer.org> wrote:
Per Jessen wrote:
I'm rebuilding from some code I wrote in 2010 and compiled with gcc 4.2.1. Compiling now with gcc 7.3.1 I get e.g. this warning:
/usr/include/aio.h:149:12: note: expected ‘struct aiocb * const* restrict’ but argument is of type ‘struct aiocb *’
So does this mean that the array of pointers might be modified (perhaps a pointer in the list added or removed or change position), but each of the things that are pointed to cannot be changed?
tbh, I'm not sure what it means. It's also interesting that it is a "note:", not even a warning. I don't recall ever looking at what 'restrict' does:
https://en.wikipedia.org/wiki/Restrict
"The use of the restrict keyword in C, in principle, allows non-obtuse C to achieve the same performance as the same program written in Fortran."
"In C99, the restrict keyword was added, which specifies that a pointer argument does not alias any other pointer argument. In Fortran, procedure arguments and other variables may not alias each other (unless they are pointers or have the target attribute), and the compiler assumes they do not. This enables excellent optimization, and is one major reason for Fortran's reputation as a fast language. "
I was meaning the "* const *" part of it. A pointer to an array of const *. That's new syntax for me.
Me too. This function (lio_listio) is passed a list of aiocbs, I guess the list might be reordered e.g. by priority, but obviously the pointers can't be changed. The man page says it is: int lio_listio(int mode, struct aiocb *const aiocb_list[], int nitems, struct sigevent *sevp); the include file says: int lio_listio (int __mode, struct aiocb *const __list[__restrict_arr], int __nent, struct sigevent *__restrict __sig) I don't think I've ever seen that modifier either - __restrict_arr. I guess there is still stuff to learn. Its a library call, presumbly that's why the author is being so particular in defining the interface. -- Per Jessen, Zürich (20.9°C) http://www.hostsuisse.com/ - virtual servers, made in Switzerland. -- To unsubscribe, e-mail: opensuse-programming+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-programming+owner@opensuse.org