On Saturday 07 January 2006 02:12, Leo Wandersleb wrote:
> hi guys
>
> nct just told me i had removed a needed line and left irc
> before i could answer.
> compiler told me the line was not needed. sorry for
> believing my compiler :((
>
> IRC.cpp:280: strtok(NULL, " =");
>
> but what are the required side-effects? Again: I feel
> terribly sorry to have caused confusion, but i'd like to know.

man strtok ;-)

More seriously, strtok, when called with a non NULL first parameter, take this 
string and return the first token, by adding a trailing 0 at the end of the 
token (so in the middle of the input string). When called with NULL, it 
continues on the same input string, returning the next token, and put a 
trailing 0 at the end of the token (so probably still in the middle of the 
input string). So if you remove a strtok, the next strtok will not return the 
same token.

This sad, strtok is a bad function because of this side effect thing. It is 
thus also non thread-safe.

Steph

-- 
http://nct.ysagoon.com


_______________________________________________
glob2-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/glob2-devel

Reply via email to