3 ms·
> deep cloning of data with simple assignment a = b; > deep equality checks bool are_equal_by_value = memcmp(a, b, sizeof(some_struct_t)); Errr, wat? We see
by pengaru 4y ago
> deep cloning of data with simple assignment a = b;
> deep equality checks bool are_equal_by_value = memcmp(a, b, sizeof(some_struct_t));
Errr, wat? We seem to have very different understandings of "deep" in this context. Neither of the above are "deep" in the sense that pointers within the struct will not be followed with their referenced data copied/compared. These are shallow operations.
- aarongeisler 4y agoYou are correct in the case of nested pointers. I am using primitive types nearly exclusively. Good observation!
- aarongeisler 4y agoI updated the post - really appreciate the attention to detail.