[cap-talk] David Wagner's Google techtalk is now up!
Rob Meijer
capibara at xs4all.nl
Thu Dec 13 08:33:42 EST 2007
On Thu, December 13, 2007 04:28, James A. Donald wrote:
> Instead of the compiler automatically constructing a run
> time check on each reference to x to make sure x is
> inside array bounds, as in C safe arrays, the compiler
> could demand the programmer can only reference x inside
> code that the compiler can know is inside array bounds.
>
> Because we have a vast amount of C and C++ code, I would
> like to see a safe almost C++ language, such that most
> existing code could be almost automatically translated
> to a safe but comparably efficient language. Java just
> seems a bit too fascist for me, but maybe anything that
> is safe, is innately a bit fascist.
Wouldn't it be possible to define a set of checks for the C++
compiler that would allow to achieve this?
For example a check to validate the code uses auto_ptr or
boost shared_ptr/weak_ptr or maybe boost intrusive_ptr
instead of raw pointers, would be very valuable if possible.
Some simpler but just as important would be things like
const_cast and reinterpret_cast.
I feel that if someone would take some time looking at C++,
stl and possibly boost from a memory safety point of view,
it should be possible to come up with a list of constructs
that could in theory be disallowed with some newly defined
flag for gcc.
The main challange would than be to do this in such a way that
implementation of these checks would not result in breakage
of regular 'safe' stl usage, what is hard giving the nature of
template based generics.
Rob
it does not brake
More information about the cap-talk
mailing list