Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!rice!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.lang.c Subject: Re: result of strstr(cs,ct) when ct is a null string Message-ID: <16209@smoke.brl.mil> Date: 21 May 91 02:41:05 GMT References: <1991May20.163227.7166@cfa.harvard.edu> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 12 In article <1991May20.163227.7166@cfa.harvard.edu> todd@cfa.harvard.edu (Todd Karakashian) writes: >Is the result of strstr(cs,ct) defined when ct is a null string >(i.e., when *ct == '\0')? >SunOS 4.1.1 strstr() returns cs in this situation. I checked the man >page, K&R 2, and the ANSI standard but couldn't find any illuminating >information (like, for example, saying it was undefined). Of the handful of lines of text in the C standard describing strstr(), almost an entire line is dedicated to answering exactly that question. I would argue that it is also redundant, in that the main description applies equally to the case of a zero-length string, but for some reason people seem to get confused by zero-sized things.