Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #70136
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Where are the exception-objects allocated? |
| Date | 2019-11-14 12:42 +0100 |
| Organization | A noiseless patient Spider |
| Message-ID | <qqjeia$lt$1@dont-email.me> (permalink) |
| References | <qqhcq2$ked$1@news.albasani.net> |
On 13.11.2019 17:59, Bonita Montero wrote: > Can anyone tell me what would be a proper way to allocate storage > for an exception-object being thrown without causing that this > allocation might fail? And remember that these objects even have > to live longer than a thread because you might refer to it by > an std::exception_ptr. For string data you can leverage the internal special immutable string class by using `std::runtime_error` or a derived class. It can of course throw when the original exception is created, but after that it's guaranteed that copying does not throw: C++17 §21.8.2/2: “Each standard library class T that derives from class exception shall have a publicly accessible copy constructor and a publicly accessible copy assignment operator that do not exit with an exception.” For other data you have to ensure this guarantee yourself. A reasonable approach is to minimize the amount of other data in an exception. - Alf
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Where are the exception-objects allocated? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 17:59 +0100
Re: Where are the exception-objects allocated? Öö Tiib <ootiib@hot.ee> - 2019-11-13 10:10 -0800
Re: Where are the exception-objects allocated? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 19:14 +0100
Re: Where are the exception-objects allocated? Öö Tiib <ootiib@hot.ee> - 2019-11-13 10:24 -0800
Re: Where are the exception-objects allocated? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 19:27 +0100
Re: Where are the exception-objects allocated? Öö Tiib <ootiib@hot.ee> - 2019-11-13 10:40 -0800
Re: Where are the exception-objects allocated? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 19:44 +0100
Re: Where are the exception-objects allocated? "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2019-11-13 21:58 -0800
Re: Where are the exception-objects allocated? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-13 10:18 -0800
Re: Where are the exception-objects allocated? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 19:28 +0100
Re: Where are the exception-objects allocated? James Kuyper <jameskuyper@alumni.caltech.edu> - 2019-11-13 10:44 -0800
Re: Where are the exception-objects allocated? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 19:46 +0100
Re: Where are the exception-objects allocated? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-13 20:06 +0100
Re: Where are the exception-objects allocated? Öö Tiib <ootiib@hot.ee> - 2019-11-13 11:36 -0800
Re: Where are the exception-objects allocated? scott@slp53.sl.home (Scott Lurndal) - 2019-11-13 19:41 +0000
Re: Where are the exception-objects allocated? Ian Collins <ian-news@hotmail.com> - 2019-11-14 20:11 +1300
Re: Where are the exception-objects allocated? "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2019-11-14 12:42 +0100
Re: Where are the exception-objects allocated? Bonita Montero <Bonita.Montero@gmail.com> - 2019-11-14 13:07 +0100
csiph-web