Not logged in
Log in now
Create an account
Subscribe to LWN
LWN.net Weekly Edition for May 23, 2013
An "enum" for Python 3
An unexpected perf feature
LWN.net Weekly Edition for May 16, 2013
A look at the PyPy 2.0 release
How will you *create* one of these pointers?
C and C++ could have non_nullable pointers, easily
Posted Aug 21, 2009 4:47 UTC (Fri) by njs (guest, #40338)
So... no problem?
Posted Aug 21, 2009 7:27 UTC (Fri) by nix (subscriber, #2304)
So at best it'd give you something like a dump of program state at the
time of the unintended NULL dereference: i.e., a core dump. The only
advantage is that the set of places you could get core dumps from might be
slightly smaller (at allocation, rather than at first dereference).
Posted Aug 21, 2009 8:05 UTC (Fri) by njs (guest, #40338)
(This is all relatively common in languages with real type systems.)
Posted Aug 21, 2009 18:50 UTC (Fri) by bronson (subscriber, #4806)
More like it mandates the null checks that everybody is supposed to do but even the most skilled programmers can't get 100% correct. It should raise the quality of all C programs.
> at best it'd give you something like a dump of program state at the
time of the unintended NULL dereference
Yes, that's better than dereferencing and getting rooted isn't it?
Posted Aug 21, 2009 19:06 UTC (Fri) by nix (subscriber, #2304)
So, yes, it's an improvement, but I'm not sure it's a large one. (I also
fear it would turn out like 'const' too often does: the semiclued majority
would just use nullable pointers everywhere because non-nullable ones
are 'too annoying'. But security-important software and software written
by clued people which can't use real languages like ocaml ;) would of
course benefit. And perhaps that's all we can hope for.)
Posted Aug 27, 2009 19:30 UTC (Thu) by hummassa (subscriber, #307)
YOU CANNOT DEREFERENCE A NULLABLE POINTER
if you want to use the star, check if it is nullable. People will start to use non-nullable pointers everywhere in their interfaces because they don't want to be checking for null all the time. :-D Cunning, eh?
Posted Aug 27, 2009 19:31 UTC (Thu) by hummassa (subscriber, #307)
Copyright © 2013, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds