#Why do I need static in this code:
14 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
i << 1 is just i * 2
The function is to return STR. So it makes no sense to me why I need static.
Because you return the buffer from this function.
See the last statement.
Without static, that buffer would be released as soon as the function returns.
This code is not thread safe.
How should I change the code?
It's fine as it is, but know that there are limitations.
I would like to make it thread safe.
Then you should probably make the caller pass the buffer into the function.
@turbid fossil Has your question been resolved? If so, run !solved :)
!solved