Skip to content
Discussion options

You must be logged in to vote

I did that because this function is intended to be used for seeing if 2 strings at runtime are equal. So, these could be strings created by something during runtime where at runtime we would know what the length of those strings are.
Since they're just C-strings (presumably null-terminated) we need something to say where those strings end i.e. where their last valid element is, that is the Count param for each string respectively.
Passing in the count can saves a lot of time in the first step of checking whether the lengths are the same, because if they're not then it's impossible that the strings are the same.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by btgvesta
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants