<p>int l = strlen(s);</p>

<p>warning C4244: '=' : conversion from '__w64 int' to 'int', possible loss of data</p>

<p>I need to replace strlen with an inline function
int l = new_strlen(s);</p>

<p>But how do I portably get the result of the strlen into the int without a warning, and without using pragmas?  I can guarantee there aren't more than 2 billion characters in my string!</p>

<p>All the obvious things like reinterpret_cast, static_cast  also produce errors or warnings.</p>

<p>EDIT: Argh. a c-style cast: (int) does work. I had been convinced that it did not.</p>

Cast it:
```
```
int i = (int) strlen(s);
```
```