-
memset() or ZeroMemory()
Is either one universally preferred? The book I'm currently reading uses memset() exclusively without ever mentioning ZeroMemory() and the only time they use memset() is to set a block of memory to 0's. Wouldn't it just be better (1 less param) to use ZeroMemory()? I haven't found anything that said ZeroMemory() was compiler or OS specific, but I was wondering if it was and that was why the author prefered memset().
-
ZeroMemory is a Windows API. If you want run your program on any other platform than Windows, use memset.
In Win32, ZeroMemeory(ptr, size) is same as memset(ptr, 0, size).
ZeroMemeory is created by Microsoft, the reason is in 80s memset can run on real mode DOS only while Windows had ran in virtual mode.
-
Thanks, Hotman_x. My game is being written with DirextX for the Win32 platform, so with this project portability isn't a concern.