Date: Thu, 5 Oct 1995 08:53:07 PDT From: Bill Fenner <fenner@parc.xerox.com> To: Andrew White <awhite@dca.net> Cc: freebsd-bugs@freebsd.org Subject: Re: bug with gcc 2.6.2? Message-ID: <95Oct5.085313pdt.177475@crevenia.parc.xerox.com> In-Reply-To: Your message of "Wed, 04 Oct 95 23:42:47 PDT." <Pine.BSF.3.91.951005022938.4818Q-100000@dca.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <Pine.BSF.3.91.951005022938.4818Q-100000@dca.net> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95Oct5.085313pdt.177475>