glob2-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [glob2-devel] :/ i was evil


From: Leo Wandersleb
Subject: Re: [glob2-devel] :/ i was evil
Date: Sun, 08 Jan 2006 17:26:43 +0100
User-agent: Mozilla Thunderbird 1.0.7 (X11/20050923)

thanx for explaining. it was clearer than the man page. so the way it is in now is better as it produces no warning.

Stéphane Magnenat wrote:
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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]