On Sun, 2006-07-16 at 19:20 +0200, [EMAIL PROTECTED] wrote: > >However dereferencing NULL SHOULD crash, and the [EMAIL PROTECTED] library > >prevents > >this. Thus the [EMAIL PROTECTED] library is not a solution to the NULL > >formatting > >problem. > > Not if you take the C standard into consideration which clearly spells > out rules which leave no room for an onterpretation other than the > one above: passing NULL to printf as argument to a %s specifier is > undefined behaviour. Both crashing and printing something weird as > well as formatting the hard drive or running "rm -rf $HOME" are > perfectly valid actions of a C implementation.
Hmm, right. So if all of these are valid, I guess the question is which one is the most sensible action. Crashing the app is somewhere between rm -rf and printing "(null)". While I agree that it's useful for developers if the app crashes in this situation, it's less so for users. One solution is writing perfect code, but we all know that it doesn't exist. Laca _______________________________________________ opensolaris-code mailing list [email protected] http://mail.opensolaris.org/mailman/listinfo/opensolaris-code
