Earlier quoted context omitted.
It's not just that the C compiler lacks the information... but the reader of this article also lacks this information. String length tells you the frequency with which nul terminators will be found. Without knowing frequency of occurrence of the nul terminator, 's', and 'p' then you cannot know which one occurs most often. Consider two benchmark cases: (1) every string tested contains exactly one character (2) every…
I guess the question is whether the compiler should optimize a function containing a loop for a single null terminator, or for more data. I would suggest the latter is what you want most of the time. There's also the option of running a quick check for the null terminator before the loop, and then optimizing the loop for the other options. But in any case, I think the demonstration of the technique of rearranging bra…
Keep at it! Just as every program is a chance to improve programming, every article written is a chance to improve writing. It was well written.