Groups | Search | Server Info | Login | Register
Groups > comp.lang.c++.moderated > #7409
| Message-ID | <nc9m4a$rbs$1@dont-email.me> (permalink) |
|---|---|
| Newsgroups | comp.lang.c++, comp.lang.c++.moderated |
| From | "Alf P. Steinbach" <alf.p.steinbach+usenet@googlemail.com> |
| Subject | Re: C++ exceptions are broken. |
| Organization | A noiseless patient Spider |
| References | (1 earlier) <20160308184714.bdb1e8f73fd1db86e9c83dc9@speakeasy.net> <NN-dnVoIWp4b-XnLnZ2dnUU7-WVj4p2d@giganews.com> <20160313124838.377cf0fcbce06a95bb9167ff@speakeasy.net> <87d1qy5aab.fsf@gmail.com> <dkqq5hFau71U1@mid.individual.net> |
| Date | 2016-03-17 06:43 -0600 |
Cross-posted to 2 groups.
On 15.03.2016 19:22, Bo Persson wrote:
>
> There is also a constructor
>
> explicit logic_error(const char*);
>
> which doesn't have to call a string constructor.
Oh, it has to allocate memory dynamically for the string if it exceeds
some buffer size, because there is no requirement that the actual
argument points to a string that will outlive the exception object.
Most probably any particular implementation delegates the dynamic
allocation job to `std::string`.
However, considering that `what` is virtual function that produces a
`char const*`, it's not difficult at all to create a derived exception
class that doesn't do dynamic allocation.
Cheers!,
- Alf
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Back to comp.lang.c++.moderated | Previous | Next — Previous in thread | Next in thread | Find similar
C++ exceptions are broken. Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-03-08 06:31 -0600
Re: C++ exceptions are broken. "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-09 08:25 -0600
Re: C++ exceptions are broken. Elias Salomão Helou Neto <eshneto@googlemail.com> - 2016-03-12 06:28 -0600
Re: C++ exceptions are broken. Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2016-03-12 14:46 -0600
Re: C++ exceptions are broken. Hergen Lehmann <hlehmann.expires.5-11@snafu.de> - 2016-03-12 16:50 -0600
Re: C++ exceptions are broken. "James K. Lowden" <jklowden@speakeasy.net> - 2016-03-13 15:55 -0600
Re: C++ exceptions are broken. Gareth Owen <gwowen@googlemail.com> - 2016-03-15 08:45 -0600
Re: C++ exceptions are broken. Bo Persson <bop@gmb.dk> - 2016-03-15 12:22 -0600
Re: C++ exceptions are broken. "Alf P. Steinbach" <alf.p.steinbach+usenet@googlemail.com> - 2016-03-17 06:43 -0600
Re: C++ exceptions are broken. Paavo Helde <myfirstname@osa.pri.ee> - 2016-03-17 06:43 -0600
Re: C++ exceptions are broken. Gareth Owen <gwowen@googlemail.com> - 2016-03-15 08:44 -0600
csiph-web