| ▲ | cesarb an hour ago | |
> If I wrote some code, I expect it to be present in the binary. I don't just write code to be removed by the compiler. It's very common to write code in templates or inline functions expecting the compiler to remove it if it's not relevant on the calling site. That's part of what makes "zero cost abstractions" have zero cost at runtime. For instance, I have a SIMD routine with extra code to process the tail (leftover elements smaller than the native vector size). When the compiler can prove that the size of the input will always be a multiple of the vector size (which is very common for my use cases), it will completely remove that tail handling code. | ||
| ▲ | vbezhenar 23 minutes ago | parent [-] | |
They you'll see that warning and mark your extra code to remove that warning, because you're aware that it's subject to potential elimination. | ||