Xref: news2.mv.net comp.os.msdos.djgpp:4306 Newsgroups: comp.os.msdos.djgpp From: tgl AT netcom DOT com (Tom Lane) Subject: Re: printf("%s",0) - Segmentation fault Message-ID: Sender: tgl AT netcom9 DOT netcom DOT com Organization: Netcom Online Communications Services References: <31A987B6 DOT F1 AT algonet DOT se> Date: Tue, 28 May 1996 03:17:32 GMT Lines: 13 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Rikard Thunberg writes: > Is it possible to tell the compiler what to do in this situation? Sure: printf("%s", (ptr ? ptr : "(Null)")); If you rely on printf not to dereference a null pointer that you hand it, you deserve what you get. Ditto for any other library routine that's not specifically documented to handle a null pointer specially --- and darn few are, at least in the ANSI C spec. regards, tom lane