4 ms·
unsigned long *wfds = (unsigned long *)wfds_out; Unless fd_set has the same or stricter alignment requirements as unsigned long, and fd_set and unsigned long a
by adynatos 9y ago
unsigned long *wfds = (unsigned long *)wfds_out;
Unless fd_set has the same or stricter alignment requirements as unsigned long, and fd_set and unsigned long are compatible effective types, this line of code provokes undefined behaviour twice (breaks strict alignment and breaks effective type access).
- beeforpork 9y agoIn this case, it is most probably OK, because wfds_out comes from calloc(), which uses the largest possible alignment to work for any type (it returns void* and cannot know which types are inside the allocated memory, so it needs to assume the max on the architecture).