c++ - Null vs ZeroMemory -
what difference between setting object null , using zeromemory?
i hear practice in winapi (which c) person should use zeromemory on c objects. come background of c# , seems c++ guy should know.
i found directx api, whether zeromemory objects or not, application still works, samples use zeromemory , don't.
can clarify these things?
zeromemory
fills block of memory zeros.
setting pointer null make pointer points nothing, , is different filling memory pointer pointing zeros (you still able access memory via pointer, example).
before can useful object, need replace these zeros more meaningful - why both programs use zeromemory
or not works.
reason zeromemory
in context find operations on objects not initialized @ point of access (for example, visual studio filling uninitialized memory 0x0c0c0c0c
/* or similar */, when encounter pattern during debugging, know object has not been initialized yet).