I’m reading through the LZMA SDK source code and noticed that they assign pointers passed into a method to themselves – example (from the SDK, C/Util/7z/7zAlloc.c):
void *SzAlloc(void *p, size_t size)
{
p = p; <-- !
if (size == 0)
return 0;
#ifdef _SZ_ALLOC_DEBUG
fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount);
g_allocCount++;
#endif
return malloc(size);
}
Can someone explain why they do this?
To avoid compiler warnings on unused parameters.