This particular syntax is a GCC extension designated by the initializer . With it, you can initialize the array as follows:
unsigned char foo[<n>] = { [0 ... <n> - 1] = <k> };
Thus, <n>is the number of members, and <k>is any given value of the member.
In the code you specified, it initializes an array networkMaskwith 0xfffor elements from the index 0through sizeof(struct in6_addr) - 1. In other words, it initializes an array of size struct in6_addrand sets all bits to 1.
This would be equivalent to this, given that the IPv6 address is 16 bytes:
unsigned char networkMask[sizeof(struct in6_addr)] = { 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255 };
source
share