`end - str` is a `ptrdiff_t`, which, for example, on Windows, has a size different from that of `long`. You want `size_t`, if you really need a cast at all. The comparison without the cast is already unsigned, so that cast only removes a warning (which isn’t enabled by default and which, I think, we still disable after the recent “more warnings” commit?) and hurts readability.