Will this C++ code cause a memory leak (casting array new)

后端 未结 24 3072
暗喜
暗喜 2021-02-14 12:26

I have been working on some legacy C++ code that uses variable length structures (TAPI), where the structure size will depend on variable length strings. The structures are allo

24条回答
  •  伪装坚强ぢ
    2021-02-14 13:03

    Rob Walker reply is good.

    Just small addition, if you don't have any constructor or/and distructors, so you basically need allocate and free a chunk of raw memory, consider using free/malloc pair.

提交回复
热议问题