Modern C compilers incompatible with modern C sockets APIhttps://twitter.com/spun_off/status/750601013791432704 …
Any remotely modern compiler inlines small constant-sized memcpys as efficient loads/stores.
-
-
might as well -fno-strict-aliasing and avoid the copying losses and adversarial riddle war
-
-fno-strict-aliasing is -fno-vectorization aka "write your vector code by hand in asm". No thanks.
End of conversation
New conversation -
-
-
it shouldn't need to bounce off memory or stack at all.
-
It needs not hit memory if there's no mem buffer; see https://godbolt.org/g/oHA3hv (using ancient gcc even).
-
That's a nice optimization. Wonder how reliable it is at scale...
-
I think it's very reliable because __builtin_memcpy is just modeled as "may_alias" access/assignment.
End of conversation
New conversation -
-
-
For copying dns/etc. results into sockaddr_in[6] you need memcpy anyway since src is your packet buffer, not ='able type.
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.