Re: like to know why it is segmentation fault on simple throw-exception program

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

 



Eric, please stop using this mailing list to learn C++.

If you have questions about G++ you can ask them here, but your
questions are just about basic C++ and are not suitable on this list.

On 2 June 2011 04:07, eric wrote:
> after it run
> -------------
> terminate called after throwing an instance of 'char const*'
> Aborted
> ----------this is better than Segmentation fault, but still not
> expected-------

It's because you throw a char*:

      throw("Push overflows stack");

You probably want to throw a bound_err:

      throw bound_err("Push overflows stack");

But again, please stop using this list to learn C++

If you are posting on comp.lang.c++ then stop repeating the posts here. Thanks.


[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