An interesting behaviour in printf
Wayne A. Throop
throopw at agarn.dg.com
Tue Mar 21 05:07:56 AEST 1989
> gwyn at smoke.BRL.MIL (Doug Gwyn )
> In my version (BRL UNIX System V emulation for 4BSD), I
> decided that the test for a null pointer was cheap insurance and I also
> have *printf("%s",(char*)0) print "(null)" rather than behave randomly.
> Such matters concern what X3J11 dubbed "quality of implementation" issues.
Uh... yeah. They involve some taste issues also, so let me add a
tangential point. I'd personally prefer not to overload an "in-band"
behavior to mean that something "out-of-band" happened. The check for
the null pointer is cheap enough, I agree, but I'd druther not simply
print a string in that case... it's practically a liscense to write
non-portable code. I'd druther do something close to
kill( getpid(), SIGSEGV );
in such a case.
--
"Who would be fighting with the weather like this?"
"Only a lunatic."
"So you think D'Artagnian is involved?"
--- Porthos, Athos, and Aramis.
--
Wayne Throop <the-known-world>!mcnc!rti!xyzzy!throopw
More information about the Comp.lang.c
mailing list