This code works for online GDB:
GDB online Debugger | Compiler - Code, Compile, Run, Debug online C, C++[
^]
I can't see why or how this code could crash. At worst, if run on a 16 bit OS, it woud overflow - but it wouldn't crash, since you're not actually using any of these values.
What compiler are you using? What OS?
On a sidenote, all of the variants you listed should yield the same result (and the recommended method would be ++len, not len++ or any of the others)
P.S.: if this is supposed to be C++ code, then you should change the first line to:
using size_int = unsigned long long;
In C++ code you should avoid #define macros as much as possible!