Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Win32 C/C++ InitStruct macro, initialize your structure as ZeroMemory, http://johnmhsheep.pixnet.net/blog, https://johnmhsieh.blogspot.com/
#ifndef _INITSTRUCT_H_
#define _INITSTRUCT_H_
//
// initialize struct
#define InitStruct(s, t) memset((void*) s, 0x0, sizeof(t))
//
// copy struct
#define CopyStruct(s_dst, s_src, t) memcpy((void*) s_dst, (void*) s_src, sizeof(t))
//
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment