tsoding / ded

Dramatic EDitor
MIT License
579 stars 76 forks source link

`da_move` could lead to undesired side effects #74

Open drocha87 opened 1 year ago

drocha87 commented 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).

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

BillKek commented 1 year ago

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