strtok bug

Mark Kettenis kettenis@wins.uva.nl
Fri Jan 14 00:07:00 GMT 2000


   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


More information about the Libc-alpha mailing list