zeroing derived struct using memset

后端 未结 4 1000
耶瑟儿~
耶瑟儿~ 2021-01-16 14:36

I want to zero out all members of a derived structure.

There are hundreds of members and more are added every once in a while so I feel that initializing them explic

4条回答
  •  日久生厌
    2021-01-16 15:22

    You should explicitly set all the values to zero and not use memset as this is not portable. The compiler/memory allocation may have housekeeping data stored that you may be overwriting.

提交回复
热议问题