Original Post
🔒 Locked
Default variable assignment
Advertisement
Note that they only get 0xCD in Debug builds, so you can easily see uninitialised memory. In Release they get whatever was in memory previously.
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Helpful links:
How To Ask Questions The Smart Way | Google can help with your question | Search MSDN for help with standard C or Windows functions
Instead of using memset, you can use your own initialisation function:
http://www.hailstorm.net/papers/smallwin32.htm#buffer
here is the content for ZeroMemory:
http://www.hailstorm.net/papers/smallwin32.htm#buffer
here is the content for ZeroMemory:
#ifdef FillMemory
#undef FillMemory
#endif
#ifdef ZeroMemory
#undef ZeroMemory
#endif
__forceinline
void FillMemory(void *dest,unsigned __int8 c,unsigned __int32 count)
{
unsigned __int32 size32=count>>2;
unsigned __int32 fill=(c<<24|c<<16|c<<8|c);
unsigned __int32 *dest32=(unsigned __int32*)dest;
switch( (count-(size32<<2)) )
{
case 3: ((unsigned __int8*)dest)[count - 3] = c;
case 2: ((unsigned __int8*)dest)[count - 2] = c;
case 1: ((unsigned __int8*)dest)[count - 1] = c;
}
while( size32-- > 0 )
*(dest32++) = fill;
} /* FillMemory */
#define ZeroMemory(dest,count) FillMemory(dest,0,count)
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement