This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]