Open drocha87 opened 1 year ago
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).
src
dst
(src).items = NULL;
count
capacity
Since src still holds a pointer to items it could cause undesired side effects.
items
I think this is a C++ problem. And C is immune.
https://github.com/tsoding/ded/blob/57d23fa58081ea393122be1eafac9a4d0a591694/src/common.h#L37-L43
I think that we should "clear"
src
after moving it todst
(setting(src).items = NULL;
and zeroing itscount
andcapacity
).Since
src
still holds a pointer toitems
it could cause undesired side effects.