2 ms·
That would be UB. In fact C does not know much about threading at all, the result of a function should be "equivalent" to what it would be if the statements wer
by Too 12y ago
That would be UB. In fact C does not know much about threading at all, the result of a function should be "equivalent" to what it would be if the statements were executed in order, unless you use some synchronization primitives.
But if you call a function, even without suppling s as a parameter, instead of simply result += s[i], then that function could have side effects on the string since the char *s is not "restrict".