This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: strtok bug
- To: clifford at clifford dot at
- Subject: Re: strtok bug
- From: Mark Kettenis <kettenis at wins dot uva dot nl>
- Date: Fri, 14 Jan 2000 09:07:08 +0100 (CET)
- CC: kaz at ashi dot footprints dot net, geoffk at cygnus dot com, libc-alpha at sourceware dot cygnus dot com
- References: <Pine.LNX.4.10.10001140751240.22626-100000@nerd.clifford.at>
Date: Fri, 14 Jan 2000 08:19:30 +0100 (CET)
From: Clifford Wolf <clifford@clifford.at>
Sure - It's not defined in the standard what should happen for subsequent
searches when allready the first call returned a NULL pointer. But it does
not say 'Read and write from a NULL pointer and dump core'. It just says
nothing about it - so the most logical thing would be to do the same thing
as it's defined for the case that the last token has been reached and
another search is invoked: returning a NULL pointer.
Whoa! NEVER EVER assume things about undefined behaviour! It is
probably best to think about undefined behaviour as: "If I do this, my
program will fault and dump core".
Mark