Browse - Programming Tips - What's the best way (in win32) to clear memory?
Q. What's the best way (in win32) to clear memory?
In ye olden days I used to code:
memset(&MyStruct, 0, sizeof(MyStruct));
Now I write:
Which is one character longer but reads nicer.
This is defined in the Win32 headers as:
#define ZeroMemory(Destination,Length) memset((Destination),0,(Length))
Sadly bzero is deprecated so you can define it:
#define bzero(_d, _n) memset((_d), 0, (_n))