C and C++ could have non_nullable pointers, easily
Posted Aug 21, 2009 22:53 UTC (Fri) by
nix (subscriber, #2304)
In reply to:
C and C++ could have non_nullable pointers, easily by hppnq
Parent article:
Null pointers, one month later
I've maintained code that actually went so far as to do this:
struct blah *foo (...)
{
if (error_1)
return NULL;
if (error_2)
return (struct blah *)1;
if (error 3)
return (struct blah *)2;
/* repeat for ten or so errors */
return /* a real struct blah */;
}
After I'd finished being sick into the keyboard I got a new keyboard and
fixed it so it didn't do that anymore.
(
Log in to post comments)