> On Tue, Dec 3, 2013 at 12:37 PM, Philip Guenther <guent...@gmail.com> wrote: > > <string.h> needs to stay until FD_ZERO() and FD_COPY() are changed to > > not use memset()/memcpy(). > > Good point. > > Would something like this work? > > #define FD_COPY(f, t) (*(fd_set *)(t) = *(const fd_set *)(f))
Regarding your FD_ZERO: > static const fd_set __fd_zero_set; > #define FD_ZERO(p) FD_COPY(&__fd_zero_set, p) I'm not super happy about that well-located gigantic .rodata "nop sled". Furhermore, as const, it will be represented in the actual filesize of every executable. > Downside is we lose const warnings. We could get those back if we > change FD_COPY into an inline function instead of a macro, or do some > GNU block-expression trickery. Hmm. Second reason against it. I think what naddy showed seems better, though the FD_ZERO expression can do with a bit more packing.