ded icon indicating copy to clipboard operation
ded copied to clipboard

`da_move` could lead to undesired side effects

Open drocha87 opened this issue 2 years ago • 1 comments

https://github.com/tsoding/ded/blob/57d23fa58081ea393122be1eafac9a4d0a591694/src/common.h#L37-L43

I think that we should "clear" src after moving it to dst (setting (src).items = NULL; and zeroing its count and capacity).

Since src still holds a pointer to items it could cause undesired side effects.

drocha87 avatar Feb 17 '23 19:02 drocha87

I think this is a C++ problem. And C is immune.

BillKek avatar Feb 18 '23 15:02 BillKek