H
hugo2
Obrhy/hugo July 12, 2004
Take a look at this memcpy() definition.
Is there a good reason the void pointer
args are cast to byte just to assign their
addresses to byte pointers?
/*from Steve Maguire's 'Writing Soild Code'*/
void *memcpy(void *pvTo,void *pvFrom,size_t size)
{
byte *pbTo = (byte *)pvTo;
byte *pbFrom = (byte *)pvFrom;
while(size-- >0)
*pbTo++ = *pbFrom++;
return (pvTo);
}
The addresses are all unsigned int. Why not
simply byte *pbTo = pvTo; to initialize?
hugo ---------
Take a look at this memcpy() definition.
Is there a good reason the void pointer
args are cast to byte just to assign their
addresses to byte pointers?
/*from Steve Maguire's 'Writing Soild Code'*/
void *memcpy(void *pvTo,void *pvFrom,size_t size)
{
byte *pbTo = (byte *)pvTo;
byte *pbFrom = (byte *)pvFrom;
while(size-- >0)
*pbTo++ = *pbFrom++;
return (pvTo);
}
The addresses are all unsigned int. Why not
simply byte *pbTo = pvTo; to initialize?
hugo ---------