From owner-freebsd-bugs Thu Oct 5 08:54:05 1995 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id IAA12808 for bugs-outgoing; Thu, 5 Oct 1995 08:54:05 -0700 Received: from alpha.xerox.com (alpha.Xerox.COM [13.1.64.93]) by freefall.freebsd.org (8.6.12/8.6.6) with SMTP id IAA12803 for ; Thu, 5 Oct 1995 08:54:01 -0700 Received: from crevenia.parc.xerox.com ([13.2.116.11]) by alpha.xerox.com with SMTP id <15416(1)>; Thu, 5 Oct 1995 08:53:19 PDT Received: from localhost by crevenia.parc.xerox.com with SMTP id <177475>; Thu, 5 Oct 1995 08:53:13 -0700 To: Andrew White cc: freebsd-bugs@freebsd.org Subject: Re: bug with gcc 2.6.2? In-reply-to: Your message of "Wed, 04 Oct 95 23:42:47 PDT." Date: Thu, 5 Oct 1995 08:53:07 PDT From: Bill Fenner Message-Id: <95Oct5.085313pdt.177475@crevenia.parc.xerox.com> Sender: owner-bugs@freebsd.org Precedence: bulk In message you write: >The following code generates a segmentation violation using gcc 2.6.2 as >shipped with FreeBSD 2.0-RELEASE. It shouldn't! Yes it should. NULL pointers are not valid "string" values. Perhaps the FreeBSD str* man pages should adopt some text similar to the SunOS man page: WARNINGS ... On the Sun processor, as well as on many other machines, you can not use a NULL pointer to indicate a null string. A NULL pointer is an error and results in an abort of the pro- gram. If you wish to indicate a null string, you must have a pointer that points to an explicit null string. On some implementations of the C language on some machines, a NULL pointer, if dereferenced, would yield a null string; this highly non-portable trick was used in some programs. Pro- grammers using a NULL pointer to represent an empty string should be aware of this portability issue; even on machines where dereferencing a NULL pointer does not cause an abort of the program, it does not necessarily yield a null string. Bill