Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C Programming
Efficency and the standard library
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="Keith Thompson, post: 4027009"] Note that ``end - string'' yields a value of type ptrdiff_t, a signed type which very likely can't represent all values of type size_t. This is unlikely to be an issue in practice. On typical 32-bit systems, problems show up only for strings longer than 2 gigabytes, and even then the properties of 2's-complement arithmetic are likely to result in the correct answer anyway. But all this analysis, resulting in the conclusion that it will almost certainly work properly, becomes unnecessary if you just use strlen(). [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
Efficency and the standard library
Top