oneDPL icon indicating copy to clipboard operation
oneDPL copied to clipboard

Needs to remove run-time check which is always `false`

Open SergeyKopienko opened this issue 11 months ago • 3 comments

https://github.com/uxlfoundation/oneDPL/blob/33828957adb7af014900969e2c25aa0813b48ea8/include/oneapi/dpl/experimental/kt/single_pass_scan.h#L389

Probably better replace to

#if 0
    // code
#else
    // code
#endif

SergeyKopienko avatar Feb 03 '25 11:02 SergeyKopienko

Tagging @danhoeflinger

I think #if 0 is not really better that the "runtime" check; it's still dead code. In some sense it's even worse, because now this code should at least compile without errors.

In principle, any "branching" is only needed if we expect the two code variants to coexist for some time in the future. In that case there should be a better condition check instead of "true/false", at least a named variable/macro.

If we do not expect the need to have two variants of the code and want to avoid dead code, I would just use comments.

akukanov avatar Feb 03 '25 12:02 akukanov

Perhaps @adamfidel is the better person to tag here. I'm happy to make some changes here to improve this, but I didn't write this code.

danhoeflinger avatar Feb 03 '25 17:02 danhoeflinger

I agree that commenting out the if (0) branch would be an acceptable alternative to what is there currently.

adamfidel avatar Feb 03 '25 19:02 adamfidel