Re: Core dump constructing a C++ string with NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 14, 2011 at 11:48, Brian Budge <brian.budge@xxxxxxxxx> wrote:
> Nothing is immune to pointer problems that violate preconditions.
>
> I'm curious; is it really easier to modify the compiler than to write
> your string construction as I proposed?

Here's the situation:

open source library A (http://brlcad.org) with many kloc of C code by
many people over decades
  - possible lots of hidden null ptr string bugs remaining (one found
just recently)

open source library A++ wrapping lib A

user of A++ gets stuck and finds one of the null char* bugs as it is
used to construct a C++ string

user of A++ can't fix A++

Now consider my original suggestion with this modification:

  consider it a built-in try {} catch {} block and trap the exception
and return an empty string as well as report the problem to stderr

The compiler option might be something like:

  "--auto-catch-c++-null-string-exception"

Now the user may be able to carry on and he can also report the bug.

Regards,

-Tom


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux