I have just been looking at some documentation for the recv
function call, which is available here.
The API is specified as
ssize_t recv(int sockfd, void buf[.size], size_t size, int flags);
I have not seen this syntax before: void buf[.size]
.
This looks like an array, void buf[]
, which I would guess is effectively the same as void*
.
However, what is the .size
object? This looks like a parameter for the length of the array.
It sort of suggests that the compiler might produce one version of recv
for each static length .size
. But this doesn't really make any sense and I can't imagine this is what the compiler is actually doing, since recv
is a library function, part of the Linux sockets library (which is already compiled, the compiler just links against it).
It's the syntax adopted by the Linux Manual Pages project to indicate that the buffer's size is described by the size
parameter of the same function call.
Edit: Found the other StackOverflow thread with more detailed discussion: Linux memcpy restrict keyword syntax