Well, for one thing the static is initialized only once, the first time into the function.
What is the problem with that? I thought that was the point of a static int in a funciton like this. To retain its value after returning to the caller.
I don't know if it's a problem -- you know the code that uses the function.
Example:
On first call to appendErrorLog, let's say ptr->invalidTags.size() returns 0.
Line 3 sets size to 0.
Line 5 resizes the invalidTags container to 1.
Line 6 adds the tag to the container.
Line 9 sets invalidTagsIndex to 1.
On second call to appendErrorLog, *whatever* ptr->invalidTags.size() is:
Line 3 is not executed;
Line 5 resizes the invalidTags container to 1.
Line 6 adds the tag to the container.
Line 9 sets invalidTagsIndex to 1.
On third call to appendErrorLog, *whatever* ptr->invalidTags.size() is:
Line 3 is not executed;
Line 5 resizes the invalidTags container to 1, which has the effect of dropping the second tag.
Line 6 adds the new tag to the container.
Line 9 sets invalidTagsIndex to 1.