C and C++ could have non_nullable pointers, easily
C and C++ could have non_nullable pointers, easily
Posted Aug 20, 2009 20:22 UTC (Thu) by nix (subscriber, #2304)In reply to: C and C++ could have non_nullable pointers, easily by hummassa
Parent article: Null pointers, one month later
How will you *create* one of these pointers?
Posted Aug 21, 2009 4:47 UTC (Fri)
by njs (subscriber, #40338)
[Link] (6 responses)
So... no problem?
Posted Aug 21, 2009 7:27 UTC (Fri)
by nix (subscriber, #2304)
[Link] (5 responses)
So at best it'd give you something like a dump of program state at the
Posted Aug 21, 2009 8:05 UTC (Fri)
by njs (subscriber, #40338)
[Link]
(This is all relatively common in languages with real type systems.)
Posted Aug 21, 2009 18:50 UTC (Fri)
by bronson (subscriber, #4806)
[Link] (3 responses)
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
Yes, that's better than dereferencing and getting rooted isn't it?
Posted Aug 21, 2009 19:06 UTC (Fri)
by nix (subscriber, #2304)
[Link] (2 responses)
So, yes, it's an improvement, but I'm not sure it's a large one. (I also
Posted Aug 27, 2009 19:30 UTC (Thu)
by hummassa (subscriber, #307)
[Link] (1 responses)
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)
[Link]
C and C++ could have non_nullable pointers, easily
C and C++ could have non_nullable pointers, easily
everyone should already be doing anyway, and replaces it with something
which is sufficiently automated that I can't see how it could provide
helpful output at runtime (unless it did a longjmp() or EH got added to C
or something).
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).
C and C++ could have non_nullable pointers, easily
C and C++ could have non_nullable pointers, easily
time of the unintended NULL dereference
C and C++ could have non_nullable pointers, easily
kernels and those very rare userspace programs that dereference things at
address zero or have structures whose sizeof() is in the multimegabyte
range), dereferencing null pointers doesn't lead to a root hole, but to a
crash. DoSes are bad enough, and it's still a bug...
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.)
C and C++ could have non_nullable pointers, easily
C and C++ could have non_nullable pointers, easily
