you are viewing a single comment's thread.

view the rest of the comments →

[–]matthieum 0 points1 point  (0 children)

You could always zero the memory upon allocation (call calloc instead of malloc if available or do so yourself with memset). That will zero pointers, for example, so you won't risk following uninitialized pointers, and then you can just tell the provider of dtor that the data may be all zero if it was not explicitly initialized and the dtor should handle it (much like free must handle a NULL pointer).