From: Craig Gallek > Sent: 04 October 2017 14:58 > >> + obj->maps[map_idx].def = *def; > > > > I'm not too happy/comfortable with this way of copying the memory of > > "def" (the type-cased struct bpf_map_def). I guess it works, and is > > part of the C-standard(?). > > I believe this is a C++-ism. I'm not sure if it was pulled into the > C99 standard or if it's just a gcc 'feature' now. I kept it because > it was in the initial code, but I'm happy to do an explicit copy for > v3 if that looks better.
Structure copies have been valid C for ages. Annoyingly gcc will call memcpy() directly (not a 'private' function). David