So I was going through the glimg section of the unofficial OpenGL library and came across something I found strange. In one of the functions a pointer parameter is being assigned to itself and I can't see how this could be accomplishing anything. Does this somehow force memory into cache or is it something else? Possibly a bug?
static uint8 *resample_row_generic(uint8 *out, uint8 *in_near, uint8 *in_far, int w, int hs)
{
// resample with nearest-neighbor
int i,j;
in_far = in_far; // <-- here?
for (i=0; i < w; ++i)
for (j=0; j < hs; ++j)
out[i*hs+j] = in_near[i];
return out;
}
It's there to suppress the warning that the parameter in_far
is not used in the function.
Another way to suppress the warning is:
(void)in_far;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With