Because there is no guarantee it will be, plus it's also just good form. Don't code for Windows specific, code to POSIX.
But Windows isn't necessarily POSIX-compliant, so...?
@parad0x; Why is 'len' a pointer? On 32-bit systems, 'int' is 4 bytes & a pointer is also 4 bytes. On 64-bit systems, 'int' is 4 bytes whilst a pointer is 8 bytes. In this sense, making 'len' a pointer is a waste of space. Also, you can define a starting value when using 'new'.
int *foo = new int(42);
Your loop can do your 'len' increment as well, though it really isn't necessary.
for (int i = 0; i < size; ++i, ++(*len))
As Fur attempted to point out, you can simply assign len the value of 'i' after you break out of the loop. Granted, to do this, you'll need to declare 'i' before the loop. Another issue is that 'break' will break the loop and your "++(*len)" isn't going to run, thus making the return a 0-based count. The problem with this is that 'strlen()' returns the number of characters in the string, not the last index. Finally, using 'int' as the return type is going to limit your number to half of the range that could be used. Because it is impossible to have a negative number of characters, 'unsigned int' would be a more appropriate return type. Of course, that still deviates from the standard 'strlen()', but it's a desirable modification for most.
For an additional challenge, I'd suggest trying to find a way to do it recursively.
@Fur; "while (stuff)" may be undesirable as it
could cause an infinite loop, or worse. Perhaps you mean the following:
while (*stuff++) ++len;