Hi all, A code snippet from trunk: void srgb_to_linear( double* c ) { if( *c < 0.04045 ) { *c /= 12.92; } else { *c = pow( (*c+0.055)/1.055, 2.4 ); } }
Alright, this method should not do a NULL check for performance reasons (I assume). But, shouldn't we use a reference in this case then? To signal clearly that the method does not accept NULL pointers without crashing:
void srgb_to_linear( double &c ) { if( c < 0.04045 ) { c /= 12.92; } else { c = pow( (c+0.055)/1.055, 2.4 ); } }
I'm trying to reduce the number of crashes due to simple NULL pointer crashes. I find such bugs satisfying to fix because it takes really only 1 minute to locate the bug and 1 minute to fix and commit it, but........
Ciao, Johan