Topic: Proposal to add constructors to std::bad_alloc


Author: Rich Sposato <rich.sposato@gmail.com>
Date: Fri, 1 Sep 2017 12:28:44 -0700 (PDT)
Raw View
------=_Part_2952_496205681.1504294124648
Content-Type: multipart/alternative;
 boundary="----=_Part_2953_1219705336.1504294124651"

------=_Part_2953_1219705336.1504294124651
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi,

I wrote this proposal after discovering the std::bad_alloc exception class=
=20
<http://en.cppreference.com/w/cpp/memory/new/bad_alloc> only has a default=
=20
constructor. Other exception classes have constructors with a string=20
parameter. The lack of a similar constructor in bad_alloc has caused=20
problems for me.

This is the second draft of this proposal. Please provide feedback on how=
=20
to improve it before I submit it.

I would especially prefer feedback on wording and style so that it conforms=
=20
with the wording and style of accepted proposals. I would also like=20
feedback on technical correctness.

If anybody has insights on upcoming changes to the standard exception=20
classes that might affect this proposal, please let me know.

If you prefer a Word document version of this proposal, please let me know.

Thanks,

Rich Sposato

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

The bad_alloc Constructor Parameter Proposal

=20

By Richard Sposato

September 2017

Contents

I.       Introduction. 1 <#_Toc492030627>

II.      Technical Specifications. 1 <#_Toc492030628>

III.    Motivation. 2 <#_Toc492030629>

IV.    Impact on the Standard. 5 <#_Toc492030630>

V.     Design Decisions. 5 <#_Toc492030631>

VI.    Acknowledgements. 5 <#_Toc492030632>

VII.   References. 5 <#_Toc492030633>

=20

=20
I.       Introduction=20


A proposal to add two constructors to the std::bad_alloc class so it=20
conforms to other exception classes.


*Intended Audience:*

These changes are intended for C++ programmers of intermediate through=20
expert skill level who are either authors or users of memory allocation=20
libraries.

=20
II.     Technical Specifications=20

The current implementation of bad_alloc class supports only the default=20
constructor. To avoid breaking existing code, this constructor will=20
continue to exist, and will provide an implementation defined explanatory=
=20
string for the what() function.


bad_alloc();


The two additional constructors will accept either a reference to const=20
std::string or a pointer to a C-style string. These constructors will look=
=20
identical to constructors in other exception classes.

explicit bad_alloc( const std::string & what_arg );

explicit bad_alloc( const char * what_arg );


An alternate constructor would use a string_view parameter instead of=20
either of the two above constructors.

explicit bad_alloc( std::string_view what_arg );

=20

Each will construct a bad_alloc exception object that stores what_arg as an=
=20
explanatory string that can be accessed through the what() function.

=20
III.  Motivation=20


There are several motivations for this proposal. Each of these will be=20
described in detail.

1.      Conformance to existing exception classes.

2.      Ease of making templates that construct exceptions.

3.      Ease of deriving subclasses from exception classes.

4.      Changes to C++17 new and delete operators.

5.      Allowing allocators to inform callers exactly why allocations=20
failed.

=20

*1.      **Conformance to existing exception classes.*


All other exception classes in the std namespace provide constructors that=
=20
accept either a single parameter of either a reference to a const=20
std::string or a pointer to a C-style string. The parameter provides a=20
human-readable explanation for why the program threw an exception or=20
actionable information allowing the calling code to correct the problem.

=C2=B7         logic_error

=C2=B7         invalid_argument

=C2=B7         domain_error

=C2=B7         length_error

=C2=B7         out_of_range

=C2=B7         runtime_error

=C2=B7         range_error

=C2=B7         overflow_error

=C2=B7         underflow_error

=C2=B7         tx_exception


Conformance to other exception classes will enable motivations two and=20
three for this proposal.

=20

*2.      **Ease of making templates that construct exceptions.*

*3.      **Ease of deriving subclasses from exception classes.*


Motivations #2 and #3 are related. They can be explained with a single=20
example that uses both templates and inheritance to show why bad_alloc=20
constructors should accept an explanatory string parameter.


Classes that derive from the standard exceptions cannot call the bad_alloc=
=20
constructor using the same code they would to call other exception classes.=
=20
This example illustrates how to wrap existing exception classes with a=20
smart-exception class that derives from standard exceptions.


template < class ExceptionType >

class SmartException

{

public:

      SmartException( const char * message,

unsigned int line, const char * function ) :

            *ExceptionType( message ),*

            line_( line ),

            functionName_( function )

      {}

      // ... rest of class ...

private:

      unsigned int line_;

      const char * functionName_;

};


The SmartException constructor will call a subclass constructor that=20
accepts a string parameter. This works for most exceptions, but not=20
bad_alloc.


These lines define various smart exceptions using the above class and=20
typedefs.


typedef SmartException< std::bad_alloc > SmartBadAllocException;

typedef SmartException< std::logic_error > SmartLogicErrorException;


This function shows how code would throw a smart exception so any code=20
catching the exception can report exactly where the problem occurred.


void * Allocator::Allocate( std::size_t bytes, std::size_t alignment )

{

      void * place =3D FindPlace( bytes, alignment );

      if ( place =3D=3D nullptr )

      {

            *throw SmartBadAllocException( =E2=80=9CError! Unable to alloca=
te=20
bytes.=E2=80=9D,*

*                  __LINE__, __FUNCTION__ );*

      }

      return place;

}

=20

*4.      **Changes to C++17 new and delete operators.*


There are several additional new and delete operators in the C++17=20
standard. The additional operators all have a std::align_val_t parameter to=
=20
support alignment-aware allocators. The std::align_val_t parameter will=20
become part of class-specific new and delete operators along with the=20
global operators.


void * operator new( std::size_t count, std::align_val_t al);

void * operator new[]( std::size_t count, std::align_val_t al);

void operator delete( void * ptr, std::size_t sz, std::align_val_t al );

void operator delete[]( void * ptr, std::size_t sz, std::align_val_t al );

=20

Alignment-aware allocators would be unable to allocate the required number=
=20
of bytes if the alignment is incorrect. (e.g. =E2=80=93 The caller requests=
=20
alignment on 16 byte boundaries, but the allocator only supports alignment=
=20
on 4 or 8 byte boundaries.) If the allocator throws a bad_alloc exception=
=20
for the invalid alignment, the caller may assume the program is out of=20
memory instead of assuming the alignment is incorrect. Such a caller may=20
call a new_handler believing it will make more memory available. A=20
new_handler could spend an enormous amount of time looking for memory that=
=20
is available only to find none, simply throw another bad_alloc exception,=
=20
or terminate the program by calling std::abort or std::exit. None of these=
=20
actions will resolve the simple problem of using the correct alignment.


A caller that is correctly informed the alignment is invalid could merely=
=20
repeat the request with a different alignment value. This is a low cost=20
action that provides the intended result =E2=80=93 allocating a chunk of me=
mory=20
with the correct alignment.


This means that a bad_alloc exception with a valid explanatory string could=
=20
provide the caller with actionable information to solve the problem, while=
=20
a bad_alloc exception with no (or an inaccurate) explanatory string would=
=20
lead the caller to perform an expensive or program-ending action.


When the std::align_val_t parameter is added to class-specific new and=20
delete operators, users will be able to choose alignments that are not=20
supported by the allocators they use. (This proposal assumes the global new=
=20
and delete operators will support all alignment values in the=20
std::align_val_t type, and thus it will be impossible to call a global=20
memory operator with an invalid alignment value.)

=20

*5.      **Allowing allocators to inform callers exactly why allocations=20
failed.*


Allocations may fail for reasons other than the program ran out memory.=20
There are specialized allocators that only handle requests for specific=20
sizes, such as pool allocators, that could throw exceptions if they receive=
=20
requests for sizes they cannot handle.


This example shows how an allocator might throw a bad_alloc exception with=
=20
actionable information.


void * PoolAllocator::Allocate( std::size_t bytes, std::align_val_t=20
alignment )

{

      if ( ( bytes < minAllowedSize ) || ( maxAllowedSize < bytes ) )

      {

            throw *SmartBadAllocException(*

*=E2=80=9CError! This allocator only handles allocations from 16 through 64=
 bytes=20
in size.=E2=80=9D, __LINE__, __FUNCTION__ );*

      }

      if ( !IsValidAlignment( alignment ) )

      {

            throw *SmartBadAllocException(*

*=E2=80=9CError! This allocator only handles alignments on 4 byte boundarie=
s.=E2=80=9D,=20
__LINE__, __FUNCTION__ );*

      }

      void * place =3D FindPlace( bytes, alignment );

      if ( place =3D=3D nullptr )

      {

            throw SmartBadAlloc( =E2=80=9CError! Unable to allocate bytes.=
=E2=80=9D,

                  __LINE__, __FUNCTION__ );

      }

      return place;

}

=20
IV. Impact on the Standard=20

=20

=C2=B7         Implementing this proposal will have minimal impact on the C=
++=20
Standard.

=C2=B7         It is a pure extension that does not break any existing code=
..

=C2=B7         It does not require additional changes to any library or the=
=20
existing language.

=20
V.    Design Decisions=20


This proposal brings up various questions.


1.      Should the bad_alloc exception be used only allocators fail from=20
lack of memory?

2.      Can it also be used for allocations that fail because of invalid=20
parameters (e.g. wrong size or alignment)?

3.      Can it also be used for allocations that fail because of internal=
=20
problems with the allocator?


One answer to the first and second questions is that allocators should=20
throw an out_of_range or invalid_argument exception when the size or=20
alignment parameter is invalid. Likewise, one could say allocators should=
=20
throw logic_error or runtime_error for internal problems. These answers=20
imply bad_alloc is reserved strictly for out of memory conditions, but not=
=20
for other conditions that arise during allocations.


However, many programmers write code assuming that allocators only throw=20
bad_alloc. They do not expect to catch logic_error or invalid_argument=20
exceptions, so these exceptions will propagate past the functions that=20
should have caught them. For that reason, I recommend using bad_alloc for=
=20
any problems that arise during allocations.

=20
VI. Acknowledgements=20


Many thanks to the following people who reviewed various drafts of this=20
proposal and provided feedback.


1.      Herb Sutter

2.      Andrei Alexandrescu

=20
VII.                       References=20

=20

1.      http://en.cppreference.com/w/cpp/memory/new/bad_alloc

2.      http://en.cppreference.com/w/cpp/error/logic_error

3.      http://en.cppreference.com/w/cpp/memory/new/operator_new

4.      http://en.cppreference.com/w/cpp/memory/new/operator_delete

5.      http://en.cppreference.com/w/cpp/memory/new/set_new_handler

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/d9001051-0946-4dcf-bf78-8bcdb8302989%40isocpp.or=
g.

------=_Part_2953_1219705336.1504294124651
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<br><br>I wrote this proposal after discovering <a href=
=3D"http://en.cppreference.com/w/cpp/memory/new/bad_alloc">the std::bad_all=
oc exception class</a> only has a default constructor. Other exception clas=
ses have constructors with a string parameter. The lack of a similar constr=
uctor in bad_alloc has caused problems for me.<br><br>This is the second dr=
aft of this proposal. Please provide feedback on how to improve it before I=
 submit it.<br><br>I would especially prefer feedback on wording and style =
so that it conforms with the wording and style of accepted proposals. I wou=
ld also like feedback on technical correctness.<br><br>If anybody has insig=
hts on upcoming changes to the standard exception classes that might affect=
 this proposal, please let me know.<br><br>If you prefer a Word document ve=
rsion of this proposal, please let me know.<br><br>Thanks,<br><br>Rich Spos=
ato<br><br>=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D<br><br><!--[if =
gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:RelyOnVML/>
  <o:AllowPNG/>
 </o:OfficeDocumentSettings>
</xml><![endif]-->

<p class=3D"MsoTitle" style=3D"text-align:center" align=3D"center"><span st=
yle=3D"mso-fareast-font-family:&quot;Times New Roman&quot;">The bad_alloc C=
onstructor
Parameter Proposal</span></p>

<p class=3D"MsoNormal" style=3D"text-align:center" align=3D"center">=C2=A0<=
/p>

<p class=3D"MsoNormal" style=3D"text-align:center" align=3D"center">By Rich=
ard Sposato</p>

<p class=3D"MsoNormal" style=3D"text-align:center" align=3D"center">Septemb=
er 2017</p>


 <p class=3D"MsoTocHeading">Contents<span style=3D"font-size:11.0pt;
 line-height:107%;mso-ascii-font-family:Calibri;mso-ascii-theme-font:minor-=
latin;
 mso-fareast-font-family:Calibri;mso-fareast-theme-font:minor-latin;mso-han=
si-font-family:
 Calibri;mso-hansi-theme-font:minor-latin;mso-bidi-font-family:&quot;Times =
New Roman&quot;;
 mso-bidi-theme-font:minor-bidi;color:windowtext"></span></p>
 <p class=3D"MsoToc1"><a href=3D"#_Toc492030627"><span style=3D"mso-fareast=
-font-family:&quot;Times New Roman&quot;;mso-no-proof:yes">I.</span><span s=
tyle=3D"mso-fareast-font-family:&quot;Times New Roman&quot;;mso-fareast-the=
me-font:minor-fareast;
 color:windowtext;mso-no-proof:yes;text-decoration:none;text-underline:none=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </sp=
an></span><span style=3D"mso-no-proof:yes">Introduction</span><span style=
=3D"color:windowtext;display:none;mso-hide:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none"><span style=3D"mso-tab-count:1 d=
otted">. </span></span><span style=3D"color:windowtext;display:none;mso-hid=
e:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none">1</span></a><span style=3D"mso-f=
areast-font-family:&quot;Times New Roman&quot;;mso-fareast-theme-font:minor=
-fareast;
 mso-no-proof:yes"></span></p>
 <p class=3D"MsoToc1"><a href=3D"#_Toc492030628"><span style=3D"mso-fareast=
-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">II.</span><span style=3D"mso=
-fareast-font-family:
 &quot;Times New Roman&quot;;mso-fareast-theme-font:minor-fareast;color:win=
dowtext;
 mso-no-proof:yes;text-decoration:none;text-underline:none"><span style=3D"=
mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span></span><span style=
=3D"mso-fareast-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">Technical Specifications</sp=
an><span style=3D"color:windowtext;display:none;mso-hide:screen;mso-no-proo=
f:yes;
 text-decoration:none;text-underline:none"><span style=3D"mso-tab-count:1 d=
otted">. </span></span><span style=3D"color:windowtext;display:none;mso-hid=
e:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none">1</span></a><span style=3D"mso-f=
areast-font-family:&quot;Times New Roman&quot;;mso-fareast-theme-font:minor=
-fareast;
 mso-no-proof:yes"></span></p>
 <p class=3D"MsoToc1"><a href=3D"#_Toc492030629"><span style=3D"mso-fareast=
-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">III.</span><span style=3D"ms=
o-fareast-font-family:
 &quot;Times New Roman&quot;;mso-fareast-theme-font:minor-fareast;color:win=
dowtext;
 mso-no-proof:yes;text-decoration:none;text-underline:none"><span style=3D"=
mso-tab-count:1">=C2=A0=C2=A0=C2=A0 </span></span><span style=3D"mso-fareas=
t-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">Motivation</span><span style=
=3D"color:windowtext;
 display:none;mso-hide:screen;mso-no-proof:yes;text-decoration:none;text-un=
derline:
 none"><span style=3D"mso-tab-count:1 dotted">. </span></span><span style=
=3D"color:windowtext;display:none;mso-hide:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none">2</span></a><span style=3D"mso-f=
areast-font-family:&quot;Times New Roman&quot;;mso-fareast-theme-font:minor=
-fareast;
 mso-no-proof:yes"></span></p>
 <p class=3D"MsoToc1"><a href=3D"#_Toc492030630"><span style=3D"mso-fareast=
-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">IV.</span><span style=3D"mso=
-fareast-font-family:
 &quot;Times New Roman&quot;;mso-fareast-theme-font:minor-fareast;color:win=
dowtext;
 mso-no-proof:yes;text-decoration:none;text-underline:none"><span style=3D"=
mso-tab-count:1">=C2=A0=C2=A0=C2=A0 </span></span><span style=3D"mso-fareas=
t-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">Impact on the Standard</span=
><span style=3D"color:windowtext;display:none;mso-hide:screen;mso-no-proof:=
yes;
 text-decoration:none;text-underline:none"><span style=3D"mso-tab-count:1 d=
otted">. </span></span><span style=3D"color:windowtext;display:none;mso-hid=
e:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none">5</span></a><span style=3D"mso-f=
areast-font-family:&quot;Times New Roman&quot;;mso-fareast-theme-font:minor=
-fareast;
 mso-no-proof:yes"></span></p>
 <p class=3D"MsoToc1"><a href=3D"#_Toc492030631"><span style=3D"mso-fareast=
-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">V.</span><span style=3D"mso-=
fareast-font-family:
 &quot;Times New Roman&quot;;mso-fareast-theme-font:minor-fareast;color:win=
dowtext;
 mso-no-proof:yes;text-decoration:none;text-underline:none"><span style=3D"=
mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0 </span></span><span style=3D"mso-=
fareast-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">Design Decisions</span><span=
 style=3D"color:windowtext;display:none;mso-hide:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none"><span style=3D"mso-tab-count:1 d=
otted">. </span></span><span style=3D"color:windowtext;display:none;mso-hid=
e:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none">5</span></a><span style=3D"mso-f=
areast-font-family:&quot;Times New Roman&quot;;mso-fareast-theme-font:minor=
-fareast;
 mso-no-proof:yes"></span></p>
 <p class=3D"MsoToc1"><a href=3D"#_Toc492030632"><span style=3D"mso-fareast=
-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">VI.</span><span style=3D"mso=
-fareast-font-family:
 &quot;Times New Roman&quot;;mso-fareast-theme-font:minor-fareast;color:win=
dowtext;
 mso-no-proof:yes;text-decoration:none;text-underline:none"><span style=3D"=
mso-tab-count:1">=C2=A0=C2=A0=C2=A0 </span></span><span style=3D"mso-fareas=
t-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">Acknowledgements</span><span=
 style=3D"color:windowtext;display:none;mso-hide:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none"><span style=3D"mso-tab-count:1 d=
otted">. </span></span><span style=3D"color:windowtext;display:none;mso-hid=
e:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none">5</span></a><span style=3D"mso-f=
areast-font-family:&quot;Times New Roman&quot;;mso-fareast-theme-font:minor=
-fareast;
 mso-no-proof:yes"></span></p>
 <p class=3D"MsoToc1"><a href=3D"#_Toc492030633"><span style=3D"mso-fareast=
-font-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">VII.</span><span style=3D"ms=
o-fareast-font-family:
 &quot;Times New Roman&quot;;mso-fareast-theme-font:minor-fareast;color:win=
dowtext;
 mso-no-proof:yes;text-decoration:none;text-underline:none"><span style=3D"=
mso-tab-count:1">=C2=A0=C2=A0 </span></span><span style=3D"mso-fareast-font=
-family:
 &quot;Times New Roman&quot;;mso-no-proof:yes">References</span><span style=
=3D"color:windowtext;
 display:none;mso-hide:screen;mso-no-proof:yes;text-decoration:none;text-un=
derline:
 none"><span style=3D"mso-tab-count:1 dotted">. </span></span><span style=
=3D"color:windowtext;display:none;mso-hide:screen;mso-no-proof:yes;
 text-decoration:none;text-underline:none">5</span></a><span style=3D"mso-f=
areast-font-family:&quot;Times New Roman&quot;;mso-fareast-theme-font:minor=
-fareast;
 mso-no-proof:yes"></span></p>
 <p class=3D"MsoNormal">=C2=A0</p>


<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><b><span style=3D"font-size:12.0pt;font-family:&quot;Ti=
mes New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">=C2=A0</span></b></p>

<h1 style=3D"mso-list:l1 level1 lfo5"><a name=3D"_Toc492030627"><span style=
=3D"mso-fareast-font-family:&quot;Calibri Light&quot;;mso-fareast-theme-fon=
t:major-latin;
mso-bidi-font-family:&quot;Calibri Light&quot;;mso-bidi-theme-font:major-la=
tin"><span style=3D"mso-list:Ignore">I.<span style=3D"font:7.0pt &quot;Time=
s New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span>Introduction</a><span style=3D"mso-bookmark:_Toc492030=
627"></span><span style=3D"mso-fareast-font-family:&quot;Times New Roman&qu=
ot;"></span></h1>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic"><br></span></p><p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto=
;mso-margin-bottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic">A
proposal to add two constructors to the std::bad_alloc class so it conforms=
 to
other exception classes.</span></p><p class=3D"MsoNormal" style=3D"mso-marg=
in-top-alt:auto;mso-margin-bottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic"><br></span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><b style=3D"mso-bidi-font-weight:normal"><span style=3D=
"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;mso-fareast=
-font-family:
&quot;Times New Roman&quot;">Intended Audience:</span></b></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">These changes are inte=
nded for C++
programmers of intermediate through expert skill level who are either autho=
rs
or users of memory allocation libraries.</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic">=C2=A0</span></p>

<h1 style=3D"mso-list:l1 level1 lfo5"><a name=3D"_Toc492030628"><span style=
=3D"mso-fareast-font-family:&quot;Calibri Light&quot;;mso-fareast-theme-fon=
t:major-latin;
mso-bidi-font-family:&quot;Calibri Light&quot;;mso-bidi-theme-font:major-la=
tin"><span style=3D"mso-list:Ignore">II.<span style=3D"font:7.0pt &quot;Tim=
es New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"mso-fareast-font-family:&quot;Times New=
 Roman&quot;">Technical
Specifications</span></a><span style=3D"mso-fareast-font-family:&quot;Times=
 New Roman&quot;"></span></h1>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic">The
current implementation of bad_alloc class supports only the default
constructor. To avoid breaking existing code, this constructor will continu=
e to
exist, and will provide an implementation defined explanatory string for th=
e
what() function.</span></p><p class=3D"MsoNormal" style=3D"mso-margin-top-a=
lt:auto;mso-margin-bottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic"><br></span></p>

<p class=3D"MsoNormal" style=3D"text-indent:.5in"><span style=3D"font-size:=
10.0pt;
mso-bidi-font-size:11.0pt;line-height:107%;font-family:&quot;Courier New&qu=
ot;">bad_alloc();</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic"><br></span></p><p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto=
;mso-margin-bottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic">The two
additional constructors will accept either a reference to const std::string=
 or
a pointer to a C-style string. These constructors will look identical to
constructors in other exception classes.</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;tex=
t-indent:
..5in;line-height:normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size=
:12.0pt;
font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New=
 Roman&quot;;mso-bidi-font-style:
italic">explicit bad_alloc( const std::string &amp; what_arg );</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;tex=
t-indent:
..5in;line-height:normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size=
:12.0pt;
font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New=
 Roman&quot;;mso-bidi-font-style:
italic">explicit bad_alloc( const char * what_arg );</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic"><br></span></p><p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto=
;mso-margin-bottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic">An
alternate constructor would use a string_view parameter instead of either o=
f
the two above constructors.</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;tex=
t-indent:
..5in;line-height:normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size=
:12.0pt;
font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New=
 Roman&quot;;mso-bidi-font-style:
italic">explicit bad_alloc( std::string_view what_arg );</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic">=C2=A0</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic">Each will
construct a bad_alloc exception object that stores what_arg as an explanato=
ry
string that can be accessed through the what() function.</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">=C2=A0</span></p>

<h1 style=3D"mso-list:l1 level1 lfo5"><a name=3D"_Toc492030629"><span style=
=3D"mso-fareast-font-family:&quot;Calibri Light&quot;;mso-fareast-theme-fon=
t:major-latin;
mso-bidi-font-family:&quot;Calibri Light&quot;;mso-bidi-theme-font:major-la=
tin"><span style=3D"mso-list:Ignore">III.<span style=3D"font:7.0pt &quot;Ti=
mes New Roman&quot;">=C2=A0 </span></span></span><span style=3D"mso-fareast=
-font-family:&quot;Times New Roman&quot;">Motivation</span></a><span style=
=3D"mso-fareast-font-family:&quot;Times New Roman&quot;"></span></h1>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">There are several moti=
vations for
this proposal. Each of these will be described in detail.</span></p>

<p class=3D"MsoListParagraphCxSpFirst" style=3D"mso-margin-top-alt:auto;mso=
-margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l0 l=
evel1 lfo4"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">1.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Conformance to existin=
g exception
classes.</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"mso-margin-top-alt:auto;ms=
o-margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l0 l=
evel1 lfo4"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">2.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Ease of making templat=
es that
construct exceptions.</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"mso-margin-top-alt:auto;ms=
o-margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l0 l=
evel1 lfo4"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">3.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Ease of deriving subcl=
asses from
exception classes.</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"mso-margin-top-alt:auto;ms=
o-margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l0 l=
evel1 lfo4"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">4.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Changes to C++17 new a=
nd delete
operators.</span></p>

<p class=3D"MsoListParagraphCxSpLast" style=3D"mso-margin-top-alt:auto;mso-=
margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l0 l=
evel1 lfo4"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">5.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Allowing allocators to=
 inform
callers exactly why allocations failed.</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">=C2=A0</span></p>

<p class=3D"MsoListParagraph" style=3D"mso-margin-top-alt:auto;mso-margin-b=
ottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l6 l=
evel1 lfo7"><b style=3D"mso-bidi-font-weight:normal"><span style=3D"font-si=
ze:12.0pt;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><span style=3D"mso-list:Ignore">1.<span style=3D"font:7.0pt &qu=
ot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span></b><b style=3D"mso-bidi-font-weight:normal"><span sty=
le=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;mso-fa=
reast-font-family:
&quot;Times New Roman&quot;">Conformance to existing exception classes.</sp=
an></b></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">All other exception cl=
asses in the std
namespace provide constructors that accept either a single parameter of eit=
her
a reference to a const std::string or a pointer to a C-style string. The
parameter provides a human-readable explanation for why the program threw a=
n
exception or actionable information allowing the calling code to correct th=
e
problem.</span></p>

<p class=3D"MsoListParagraphCxSpFirst" style=3D"margin-bottom:0in;margin-bo=
ttom:.0001pt;
mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l7 level1=
 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-famil=
y:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">logic_error</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-bottom:0in;margin-b=
ottom:
..0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l=
7 level1 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;fo=
nt-family:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">invalid_argument</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-bottom:0in;margin-b=
ottom:
..0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l=
7 level1 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;fo=
nt-family:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">domain_error</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-bottom:0in;margin-b=
ottom:
..0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l=
7 level1 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;fo=
nt-family:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">length_error</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-bottom:0in;margin-b=
ottom:
..0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l=
7 level1 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;fo=
nt-family:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">out_of_range</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-bottom:0in;margin-b=
ottom:
..0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l=
7 level1 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;fo=
nt-family:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">runtime_error</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-bottom:0in;margin-b=
ottom:
..0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l=
7 level1 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;fo=
nt-family:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">range_error</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-bottom:0in;margin-b=
ottom:
..0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l=
7 level1 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;fo=
nt-family:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">overflow_error</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-bottom:0in;margin-b=
ottom:
..0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l=
7 level1 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;fo=
nt-family:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">underflow_error</span></p>

<p class=3D"MsoListParagraphCxSpLast" style=3D"margin-bottom:0in;margin-bot=
tom:.0001pt;
mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l7 level1=
 lfo3"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-famil=
y:Symbol;
mso-fareast-font-family:Symbol;mso-bidi-font-family:Symbol"><span style=3D"=
mso-list:Ignore">=C2=B7<span style=3D"font:7.0pt &quot;Times New Roman&quot=
;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;">tx_exception</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Conformance to other e=
xception
classes will enable motivations two and three for this proposal.</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">=C2=A0</span></p>

<p class=3D"MsoListParagraphCxSpFirst" style=3D"mso-margin-top-alt:auto;mso=
-margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l6 l=
evel1 lfo7"><b style=3D"mso-bidi-font-weight:normal"><span style=3D"font-si=
ze:12.0pt;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><span style=3D"mso-list:Ignore">2.<span style=3D"font:7.0pt &qu=
ot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span></b><b style=3D"mso-bidi-font-weight:normal"><span sty=
le=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;mso-fa=
reast-font-family:
&quot;Times New Roman&quot;">Ease of making templates that construct except=
ions.</span></b></p>

<p class=3D"MsoListParagraphCxSpLast" style=3D"mso-margin-top-alt:auto;mso-=
margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l6 l=
evel1 lfo7"><b style=3D"mso-bidi-font-weight:normal"><span style=3D"font-si=
ze:12.0pt;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><span style=3D"mso-list:Ignore">3.<span style=3D"font:7.0pt &qu=
ot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span></b><b style=3D"mso-bidi-font-weight:normal"><span sty=
le=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;mso-fa=
reast-font-family:
&quot;Times New Roman&quot;">Ease of deriving subclasses from exception cla=
sses.</span></b></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Motivations #2 and #3 =
are related.
They can be explained with a single example that uses both templates and
inheritance to show why bad_alloc constructors should accept an explanatory
string parameter.</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Classes that derive fr=
om the
standard exceptions cannot call the bad_alloc constructor using the same co=
de
they would to call other exception classes. This example illustrates how to=
 wrap
existing exception classes with a smart-exception class that derives from
standard exceptions.</span></p><p class=3D"MsoNormal" style=3D"mso-margin-t=
op-alt:auto;mso-margin-bottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">template &lt; class
ExceptionType &gt;</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">class SmartException</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">{</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">public:</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>Sma=
rtException( const char * message,</span></p>

<p class=3D"MsoNormal" style=3D"margin-top:0in;margin-right:0in;margin-bott=
om:0in;
margin-left:.5in;margin-bottom:.0001pt;text-indent:.5in;line-height:normal"=
><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-family:&quo=
t;Courier New&quot;;
mso-fareast-font-family:&quot;Times New Roman&quot;">unsigned int line, con=
st char *
function ) :</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:2">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span><b style=3D"mso-bidi-font-weight:normal"=
><span style=3D"color:red">ExceptionType( message ),</span></b></span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:2">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>line_( line ),</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:2">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>functionName_( function )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>{}<=
/span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>// =
.... rest of class ...</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">private:</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>uns=
igned int line_;</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>con=
st char * functionName_;</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">};</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">The SmartException con=
structor will
call a subclass constructor that accepts a string parameter. This works for
most exceptions, but not bad_alloc.</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">These lines define var=
ious smart
exceptions using the above class and typedefs.</span></p><p class=3D"MsoNor=
mal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"mso-bidi-font-size:12.0pt;font-family:&quot;Courier =
New&quot;;
mso-fareast-font-family:&quot;Times New Roman&quot;">typedef SmartException=
&lt; std::bad_alloc
&gt; SmartBadAllocException;</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"mso-bidi-font-size:12.0pt;font-family:&quot;Courier =
New&quot;;
mso-fareast-font-family:&quot;Times New Roman&quot;">typedef SmartException=
&lt;
std::logic_error &gt; SmartLogicErrorException;</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">This function shows ho=
w code would
throw a smart exception so any code catching the exception can report exact=
ly
where the problem occurred.</span></p><p class=3D"MsoNormal" style=3D"mso-m=
argin-top-alt:auto;mso-margin-bottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">void * Allocator::Allocate(
std::size_t bytes, std::size_t alignment )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">{</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>voi=
d * place =3D FindPlace( bytes, alignment
);</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>if =
( place =3D=3D nullptr )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>{</=
span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:2">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span><b style=3D"mso-bidi-font-weight:normal"=
><span style=3D"color:red">throw SmartBadAllocException( =E2=80=9CError! Un=
able to allocate
bytes.=E2=80=9D,</span></b></span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><b style=3D"mso-bidi-font-weight:normal"><span style=3D"font-size:1=
0.0pt;
mso-bidi-font-size:12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-f=
ont-family:
&quot;Times New Roman&quot;;color:red"><span style=3D"mso-tab-count:3">=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 </span>__LINE__,
__FUNCTION__ );</span></b></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>}</=
span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>ret=
urn place;</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">}</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">=C2=A0</span></p>

<p class=3D"MsoListParagraph" style=3D"mso-margin-top-alt:auto;mso-margin-b=
ottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l6 l=
evel1 lfo7"><b style=3D"mso-bidi-font-weight:normal"><span style=3D"font-si=
ze:12.0pt;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><span style=3D"mso-list:Ignore">4.<span style=3D"font:7.0pt &qu=
ot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span></b><b style=3D"mso-bidi-font-weight:normal"><span sty=
le=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;mso-fa=
reast-font-family:
&quot;Times New Roman&quot;">Changes to C++17 new and delete operators.</sp=
an></b></p>

<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;line-height:107%;fon=
t-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><br></span></p><p class=3D"MsoNormal"><span style=3D"font-size:=
12.0pt;line-height:107%;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;">There are
several additional new and delete operators in the C++17 standard. The
additional operators all have a std::align_val_t parameter to support
alignment-aware allocators. The std::align_val_t parameter will become part=
 of
class-specific new and delete operators along with the global operators.</s=
pan></p><p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;line-height:=
107%;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><br></span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt"><s=
pan style=3D"font-size:10.0pt;mso-bidi-font-size:11.0pt;line-height:107%;fo=
nt-family:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">void * operator new(
std::size_t count, std::align_val_t al);</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt"><s=
pan style=3D"font-size:10.0pt;mso-bidi-font-size:11.0pt;line-height:107%;fo=
nt-family:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">void * operator new[](
std::size_t count, std::align_val_t al);</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">void operator delete( void
* ptr, std::size_t sz, std::align_val_t al );</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">void operator
delete[]( void * ptr, std::size_t sz, std::align_val_t al );</span></p>

<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;line-height:107%;fon=
t-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;">=C2=A0</span></p>

<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;line-height:107%;fon=
t-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;">Alignment-aware
allocators would be unable to allocate the required number of bytes if the
alignment is incorrect. (e.g. =E2=80=93 The caller requests alignment on 16=
 byte
boundaries, but the allocator only supports alignment on 4 or 8 byte
boundaries.) If the allocator throws a bad_alloc exception for the invalid
alignment, the caller may assume the program is out of memory instead of
assuming the alignment is incorrect. Such a caller may call a new_handler b=
elieving
it will make more memory available. A new_handler could spend an enormous
amount of time looking for memory that is available only to find none, simp=
ly
throw another bad_alloc exception, or terminate the program by calling
std::abort or std::exit. None of these actions will resolve the simple prob=
lem
of using the correct alignment.</span></p><p class=3D"MsoNormal"><span styl=
e=3D"font-size:12.0pt;line-height:107%;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><br></span></p>

<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;line-height:107%;fon=
t-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;">A caller
that is correctly informed the alignment is invalid could merely repeat the
request with a different alignment value. This is a low cost action that
provides the intended result =E2=80=93 allocating a chunk of memory with th=
e correct
alignment.</span></p>

<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;line-height:107%;fon=
t-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><br></span></p><p class=3D"MsoNormal"><span style=3D"font-size:=
12.0pt;line-height:107%;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;">This means that
a bad_alloc exception with a valid explanatory string could provide the cal=
ler
with actionable information to solve the problem, while a bad_alloc excepti=
on
with no (or an inaccurate) explanatory string would lead the caller to perf=
orm
an expensive or program-ending action.</span></p>

<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;line-height:107%;fon=
t-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><br></span></p><p class=3D"MsoNormal"><span style=3D"font-size:=
12.0pt;line-height:107%;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;">When the
std::align_val_t parameter is added to class-specific new and delete operat=
ors,
users will be able to choose alignments that are not supported by the alloc=
ators
they use. (This proposal assumes the global new and delete operators will
support all alignment values in the std::align_val_t type, and thus it will=
 be
impossible to call a global memory operator with an invalid alignment value=
..)</span></p>

<p class=3D"MsoNormal"><span style=3D"font-size:12.0pt;line-height:107%;fon=
t-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;">=C2=A0</span></p>

<p class=3D"MsoListParagraph" style=3D"mso-margin-top-alt:auto;mso-margin-b=
ottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l6 l=
evel1 lfo7"><b style=3D"mso-bidi-font-weight:normal"><span style=3D"font-si=
ze:12.0pt;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;"><span style=3D"mso-list:Ignore">5.<span style=3D"font:7.0pt &qu=
ot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span></b><b style=3D"mso-bidi-font-weight:normal"><span sty=
le=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif;mso-fa=
reast-font-family:
&quot;Times New Roman&quot;">Allowing allocators to inform callers exactly =
why
allocations failed.</span></b></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Allocations may fail f=
or reasons
other than the program ran out memory. There are specialized allocators tha=
t
only handle requests for specific sizes, such as pool allocators, that coul=
d
throw exceptions if they receive requests for sizes they cannot handle.</sp=
an></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">This example shows how=
 an allocator
might throw a bad_alloc exception with actionable information.</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><br></span></p><p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-b=
ottom:.0001pt;line-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">void * PoolAllocator::Allocate(
std::size_t bytes, std::align_val_t alignment )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">{</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>if =
( ( bytes &lt; minAllowedSize ) || (
maxAllowedSize &lt; bytes ) )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>{</=
span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:2">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>throw <b style=3D"mso-bidi-font-weight:
normal"><span style=3D"color:red">SmartBadAllocException(</span></b></span>=
</p>

<p class=3D"MsoNormal" style=3D"margin-top:0in;margin-right:0in;margin-bott=
om:0in;
margin-left:1.0in;margin-bottom:.0001pt;text-indent:.5in;line-height:normal=
"><b style=3D"mso-bidi-font-weight:normal"><span style=3D"font-size:10.0pt;=
mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;;
color:red">=E2=80=9CError! This allocator only handles allocations from 16 =
through 64
bytes in size.=E2=80=9D, __LINE__, __FUNCTION__ );</span></b></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>}</=
span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>if =
( !IsValidAlignment( alignment ) )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>{</=
span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:2">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>throw <b style=3D"mso-bidi-font-weight:
normal"><span style=3D"color:red">SmartBadAllocException(</span></b></span>=
</p>

<p class=3D"MsoNormal" style=3D"margin-top:0in;margin-right:0in;margin-bott=
om:0in;
margin-left:1.0in;margin-bottom:.0001pt;text-indent:.5in;line-height:normal=
"><b style=3D"mso-bidi-font-weight:normal"><span style=3D"font-size:10.0pt;=
mso-bidi-font-size:
12.0pt;font-family:&quot;Courier New&quot;;mso-fareast-font-family:&quot;Ti=
mes New Roman&quot;;
color:red">=E2=80=9CError! This allocator only handles alignments on 4 byte
boundaries.=E2=80=9D, __LINE__, __FUNCTION__ );</span></b></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>}</=
span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>voi=
d * place =3D FindPlace( bytes, alignment
);</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>if =
( place =3D=3D nullptr )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>{</=
span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:2">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>throw SmartBadAlloc( =E2=80=9CError! Una=
ble
to allocate bytes.=E2=80=9D,</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:3">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>__LI=
NE__, __FUNCTION__ );</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>}</=
span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
"><span style=3D"mso-tab-count:1">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>ret=
urn place;</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:10.0pt;mso-bidi-font-size:12.0pt;font-fami=
ly:
&quot;Courier New&quot;;mso-fareast-font-family:&quot;Times New Roman&quot;=
">}</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">=C2=A0</span></p>

<h1 style=3D"mso-list:l1 level1 lfo5"><a name=3D"_Toc492030630"><span style=
=3D"mso-fareast-font-family:&quot;Calibri Light&quot;;mso-fareast-theme-fon=
t:major-latin;
mso-bidi-font-family:&quot;Calibri Light&quot;;mso-bidi-theme-font:major-la=
tin"><span style=3D"mso-list:Ignore">IV.<span style=3D"font:7.0pt &quot;Tim=
es New Roman&quot;"> </span></span></span><span style=3D"mso-fareast-font-f=
amily:&quot;Times New Roman&quot;">Impact on the Standard</span></a><span s=
tyle=3D"mso-fareast-font-family:&quot;Times New Roman&quot;"></span></h1>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:
normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&q=
uot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">=C2=A0</span></p>

<p class=3D"MsoListParagraphCxSpFirst" style=3D"margin-bottom:0in;margin-bo=
ttom:.0001pt;
mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l2 level1=
 lfo2"><span style=3D"font-size:12.0pt;font-family:Symbol;mso-fareast-font-=
family:Symbol;
mso-bidi-font-family:Symbol"><span style=3D"mso-list:Ignore">=C2=B7<span st=
yle=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Implementing this prop=
osal will have
minimal impact on the C++ Standard.</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-bottom:0in;margin-b=
ottom:
..0001pt;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l=
2 level1 lfo2"><span style=3D"font-size:12.0pt;font-family:Symbol;mso-farea=
st-font-family:Symbol;
mso-bidi-font-family:Symbol"><span style=3D"mso-list:Ignore">=C2=B7<span st=
yle=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">It is a pure extension=
 that does not
break any existing code.</span></p>

<p class=3D"MsoListParagraphCxSpLast" style=3D"margin-bottom:0in;margin-bot=
tom:.0001pt;
mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l2 level1=
 lfo2"><span style=3D"font-size:12.0pt;font-family:Symbol;mso-fareast-font-=
family:Symbol;
mso-bidi-font-family:Symbol"><span style=3D"mso-list:Ignore">=C2=B7<span st=
yle=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">It does not require ad=
ditional
changes to any library or the existing language.</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">=C2=A0</span></p>

<h1 style=3D"mso-list:l1 level1 lfo5"><a name=3D"_Toc492030631"><span style=
=3D"mso-fareast-font-family:&quot;Calibri Light&quot;;mso-fareast-theme-fon=
t:major-latin;
mso-bidi-font-family:&quot;Calibri Light&quot;;mso-bidi-theme-font:major-la=
tin"><span style=3D"mso-list:Ignore">V.<span style=3D"font:7.0pt &quot;Time=
s New Roman&quot;">=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"mso-fareast-font-family:&quot;Times New=
 Roman&quot;">Design
Decisions</span></a><span style=3D"mso-fareast-font-family:&quot;Times New =
Roman&quot;"></span></h1>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">This proposal brings u=
p various
questions.</span></p><p class=3D"MsoNormal" style=3D"mso-margin-top-alt:aut=
o;mso-margin-bottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p>

<p class=3D"MsoListParagraphCxSpFirst" style=3D"mso-margin-top-alt:auto;mso=
-margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l3 l=
evel1 lfo6"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">1.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Should the bad_alloc e=
xception be
used only allocators fail from lack of memory?</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"mso-margin-top-alt:auto;ms=
o-margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l3 l=
evel1 lfo6"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">2.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Can it also be used fo=
r allocations
that fail because of invalid parameters (e.g. wrong size or alignment)?</sp=
an></p>

<p class=3D"MsoListParagraphCxSpLast" style=3D"mso-margin-top-alt:auto;mso-=
margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l3 l=
evel1 lfo6"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">3.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Can it also be used fo=
r allocations
that fail because of internal problems with the allocator?</span></p><p cla=
ss=3D"MsoListParagraphCxSpLast" style=3D"mso-margin-top-alt:auto;mso-margin=
-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l3 l=
evel1 lfo6"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">One answer to the firs=
t and second
questions is that allocators should throw an out_of_range or invalid_argume=
nt exception
when the size or alignment parameter is invalid. Likewise, one could say
allocators should throw logic_error or runtime_error for internal problems.
These answers imply bad_alloc is reserved strictly for out of memory
conditions, but not for other conditions that arise during allocations.</sp=
an></p><p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-b=
ottom-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">However, many programm=
ers write code
assuming that allocators only throw bad_alloc. They do not expect to catch =
logic_error
or invalid_argument exceptions, so these exceptions will propagate past the
functions that should have caught them. For that reason, I recommend using
bad_alloc for any problems that arise during allocations.</span></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-style:ita=
lic">=C2=A0</span></p>

<h1 style=3D"mso-list:l1 level1 lfo5"><a name=3D"_Toc492030632"><span style=
=3D"mso-fareast-font-family:&quot;Calibri Light&quot;;mso-fareast-theme-fon=
t:major-latin;
mso-bidi-font-family:&quot;Calibri Light&quot;;mso-bidi-theme-font:major-la=
tin"><span style=3D"mso-list:Ignore">VI.<span style=3D"font:7.0pt &quot;Tim=
es New Roman&quot;"> </span></span></span><span style=3D"mso-fareast-font-f=
amily:&quot;Times New Roman&quot;">Acknowledgements</span></a><span style=
=3D"mso-fareast-font-family:&quot;Times New Roman&quot;"></span></h1>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p><p clas=
s=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-alt:auto=
;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Many thanks to the fol=
lowing people
who reviewed various drafts of this proposal and provided feedback.</span><=
/p><p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-botto=
m-alt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><br></span></p>

<p class=3D"MsoListParagraphCxSpFirst" style=3D"mso-margin-top-alt:auto;mso=
-margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l4 l=
evel1 lfo8"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">1.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Herb Sutter</span></p>

<p class=3D"MsoListParagraphCxSpLast" style=3D"mso-margin-top-alt:auto;mso-=
margin-bottom-alt:
auto;mso-add-space:auto;text-indent:-.25in;line-height:normal;mso-list:l4 l=
evel1 lfo8"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Rom=
an&quot;,serif;mso-fareast-font-family:
&quot;Times New Roman&quot;"><span style=3D"mso-list:Ignore">2.<span style=
=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">Andrei Alexandrescu</s=
pan></p>

<p class=3D"MsoNormal" style=3D"mso-margin-top-alt:auto;mso-margin-bottom-a=
lt:auto;
line-height:normal"><span style=3D"font-size:12.0pt;font-family:&quot;Times=
 New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">=C2=A0</span></p>

<h1 style=3D"mso-list:l1 level1 lfo5"><a name=3D"_Toc492030633"><span style=
=3D"mso-fareast-font-family:&quot;Calibri Light&quot;;mso-fareast-theme-fon=
t:major-latin;
mso-bidi-font-family:&quot;Calibri Light&quot;;mso-bidi-theme-font:major-la=
tin"><span style=3D"mso-list:Ignore">VII.<span style=3D"font:7.0pt &quot;Ti=
mes New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0
</span></span></span><span style=3D"mso-fareast-font-family:&quot;Times New=
 Roman&quot;">References</span></a><span style=3D"mso-fareast-font-family:&=
quot;Times New Roman&quot;"></span></h1>

<p class=3D"MsoListParagraphCxSpFirst"><span style=3D"font-size:12.0pt;line=
-height:
107%;font-family:&quot;Times New Roman&quot;,serif;mso-fareast-font-family:=
&quot;Times New Roman&quot;">=C2=A0</span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-left:.75in;mso-add-=
space:
auto;text-indent:-.25in;mso-list:l5 level1 lfo1"><span style=3D"font-size:1=
2.0pt;line-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><span style=3D"mso-lis=
t:Ignore">1.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 </span></span></span><a href=3D"http://en.cpprefer=
ence.com/w/cpp/memory/new/bad_alloc"><span style=3D"font-size:12.0pt;line-h=
eight:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">http://en.cppreference=
..com/w/cpp/memory/new/bad_alloc</span></a><span style=3D"font-size:12.0pt;l=
ine-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"></span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-left:.75in;mso-add-=
space:
auto;text-indent:-.25in;mso-list:l5 level1 lfo1"><span style=3D"font-size:1=
2.0pt;line-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><span style=3D"mso-lis=
t:Ignore">2.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 </span></span></span><a href=3D"http://en.cpprefer=
ence.com/w/cpp/error/logic_error"><span style=3D"font-size:12.0pt;line-heig=
ht:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">http://en.cppreference=
..com/w/cpp/error/logic_error</span></a><span style=3D"font-size:12.0pt;line=
-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"></span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-left:.75in;mso-add-=
space:
auto;text-indent:-.25in;mso-list:l5 level1 lfo1"><span style=3D"font-size:1=
2.0pt;line-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><span style=3D"mso-lis=
t:Ignore">3.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 </span></span></span><a href=3D"http://en.cpprefer=
ence.com/w/cpp/memory/new/operator_new"><span style=3D"font-size:12.0pt;lin=
e-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">http://en.cppreference=
..com/w/cpp/memory/new/operator_new</span></a><span style=3D"font-size:12.0p=
t;line-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"></span></p>

<p class=3D"MsoListParagraphCxSpMiddle" style=3D"margin-left:.75in;mso-add-=
space:
auto;text-indent:-.25in;mso-list:l5 level1 lfo1"><span class=3D"MsoHyperlin=
k"><span style=3D"font-size:12.0pt;line-height:107%;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;;color:windowtext;
text-decoration:none;text-underline:none"><span style=3D"mso-list:Ignore">4=
..<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0 </span></span></span></span><a href=3D"http://en.cppreference.=
com/w/cpp/memory/new/operator_delete"><span style=3D"font-size:12.0pt;line-=
height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">http://en.cppreference=
..com/w/cpp/memory/new/operator_delete</span></a><span class=3D"MsoHyperlink=
"><span style=3D"font-size:12.0pt;line-height:107%;font-family:
&quot;Times New Roman&quot;,serif;mso-fareast-font-family:&quot;Times New R=
oman&quot;;color:windowtext;
text-decoration:none;text-underline:none"></span></span></p>

<p class=3D"MsoListParagraphCxSpLast" style=3D"margin-left:.75in;mso-add-sp=
ace:auto;
text-indent:-.25in;mso-list:l5 level1 lfo1"><span style=3D"font-size:12.0pt=
;line-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"><span style=3D"mso-lis=
t:Ignore">5.<span style=3D"font:7.0pt &quot;Times New Roman&quot;">=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 </span></span></span><a href=3D"http://en.cpprefer=
ence.com/w/cpp/memory/new/set_new_handler"><span style=3D"font-size:12.0pt;=
line-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;">http://en.cppreference=
..com/w/cpp/memory/new/set_new_handler</span></a><span style=3D"font-size:12=
..0pt;line-height:107%;font-family:&quot;Times New Roman&quot;,serif;
mso-fareast-font-family:&quot;Times New Roman&quot;"></span></p>

<!--[if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:TrackMoves/>
  <w:TrackFormatting/>
  <w:PunctuationKerning/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:DoNotPromoteQF/>
  <w:LidThemeOther>EN-US</w:LidThemeOther>
  <w:LidThemeAsian>X-NONE</w:LidThemeAsian>
  <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
   <w:SplitPgBreakAndParaMark/>
   <w:EnableOpenTypeKerning/>
   <w:DontFlipMirrorIndents/>
   <w:OverrideTableStyleHps/>
  </w:Compatibility>
  <m:mathPr>
   <m:mathFont m:val=3D"Cambria Math"/>
   <m:brkBin m:val=3D"before"/>
   <m:brkBinSub m:val=3D"&#45;-"/>
   <m:smallFrac m:val=3D"off"/>
   <m:dispDef/>
   <m:lMargin m:val=3D"0"/>
   <m:rMargin m:val=3D"0"/>
   <m:defJc m:val=3D"centerGroup"/>
   <m:wrapIndent m:val=3D"1440"/>
   <m:intLim m:val=3D"subSup"/>
   <m:naryLim m:val=3D"undOvr"/>
  </m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
 <w:LatentStyles DefLockedState=3D"false" DefUnhideWhenUsed=3D"false"
  DefSemiHidden=3D"false" DefQFormat=3D"false" DefPriority=3D"99"
  LatentStyleCount=3D"371">
  <w:LsdException Locked=3D"false" Priority=3D"0" QFormat=3D"true" Name=3D"=
Normal"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" QFormat=3D"true" Name=3D"=
heading 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"heading 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"heading 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"heading 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"heading 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"heading 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"heading 7"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"heading 8"/>
  <w:LsdException Locked=3D"false" Priority=3D"9" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"heading 9"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index 4"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index 5"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index 6"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index 7"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index 8"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index 9"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"toc 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"toc 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"toc 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"toc 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"toc 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"toc 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"toc 7"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"toc 8"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"toc 9"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Normal Indent"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"footnote text"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"annotation text"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"header"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"footer"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"index heading"/>
  <w:LsdException Locked=3D"false" Priority=3D"35" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"caption"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"table of figures"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"envelope address"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"envelope return"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"footnote reference"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"annotation reference"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"line number"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"page number"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"endnote reference"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"endnote text"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"table of authorities"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"macro"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"toa heading"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Bullet"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Number"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List 4"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List 5"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Bullet 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Bullet 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Bullet 4"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Bullet 5"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Number 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Number 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Number 4"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Number 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"10" QFormat=3D"true" Name=3D=
"Title"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Closing"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Signature"/>
  <w:LsdException Locked=3D"false" Priority=3D"1" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"Default Paragraph Font"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Body Text"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Body Text Indent"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Continue"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Continue 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Continue 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Continue 4"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"List Continue 5"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Message Header"/>
  <w:LsdException Locked=3D"false" Priority=3D"11" QFormat=3D"true" Name=3D=
"Subtitle"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Salutation"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Date"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Body Text First Indent"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Body Text First Indent 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Note Heading"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Body Text 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Body Text 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Body Text Indent 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Body Text Indent 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Block Text"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Hyperlink"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"FollowedHyperlink"/>
  <w:LsdException Locked=3D"false" Priority=3D"22" QFormat=3D"true" Name=3D=
"Strong"/>
  <w:LsdException Locked=3D"false" Priority=3D"20" QFormat=3D"true" Name=3D=
"Emphasis"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Document Map"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Plain Text"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"E-mail Signature"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Top of Form"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Bottom of Form"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Normal (Web)"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Acronym"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Address"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Cite"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Code"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Definition"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Keyboard"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Preformatted"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Sample"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Typewriter"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"HTML Variable"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Normal Table"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"annotation subject"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"No List"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Outline List 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Outline List 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Outline List 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Simple 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Simple 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Simple 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Classic 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Classic 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Classic 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Classic 4"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Colorful 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Colorful 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Colorful 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Columns 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Columns 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Columns 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Columns 4"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Columns 5"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Grid 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Grid 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Grid 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Grid 4"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Grid 5"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Grid 6"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Grid 7"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Grid 8"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table List 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table List 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table List 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table List 4"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table List 5"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table List 6"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table List 7"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table List 8"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table 3D effects 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table 3D effects 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table 3D effects 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Contemporary"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Elegant"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Professional"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Subtle 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Subtle 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Web 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Web 2"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Web 3"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Balloon Text"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" Name=3D"Table Grid"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" UnhideWhenUsed=3D"tr=
ue"
   Name=3D"Table Theme"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" Name=3D"Placeholder =
Text"/>
  <w:LsdException Locked=3D"false" Priority=3D"1" QFormat=3D"true" Name=3D"=
No Spacing"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" Name=3D"Light Shading"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" Name=3D"Light List"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" Name=3D"Light Grid"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" Name=3D"Medium Shading 1=
"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" Name=3D"Medium Shading 2=
"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" Name=3D"Medium List 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" Name=3D"Medium List 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" Name=3D"Medium Grid 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" Name=3D"Medium Grid 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" Name=3D"Medium Grid 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" Name=3D"Dark List"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" Name=3D"Colorful Shading=
"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" Name=3D"Colorful List"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" Name=3D"Colorful Grid"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" Name=3D"Light Shading Ac=
cent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" Name=3D"Light List Accen=
t 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" Name=3D"Light Grid Accen=
t 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" Name=3D"Medium Shading 1=
 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" Name=3D"Medium Shading 2=
 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" Name=3D"Medium List 1 Ac=
cent 1"/>
  <w:LsdException Locked=3D"false" SemiHidden=3D"true" Name=3D"Revision"/>
  <w:LsdException Locked=3D"false" Priority=3D"34" QFormat=3D"true"
   Name=3D"List Paragraph"/>
  <w:LsdException Locked=3D"false" Priority=3D"29" QFormat=3D"true" Name=3D=
"Quote"/>
  <w:LsdException Locked=3D"false" Priority=3D"30" QFormat=3D"true"
   Name=3D"Intense Quote"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" Name=3D"Medium List 2 Ac=
cent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" Name=3D"Medium Grid 1 Ac=
cent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" Name=3D"Medium Grid 2 Ac=
cent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" Name=3D"Medium Grid 3 Ac=
cent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" Name=3D"Dark List Accent=
 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" Name=3D"Colorful Shading=
 Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" Name=3D"Colorful List Ac=
cent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" Name=3D"Colorful Grid Ac=
cent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" Name=3D"Light Shading Ac=
cent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" Name=3D"Light List Accen=
t 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" Name=3D"Light Grid Accen=
t 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" Name=3D"Medium Shading 1=
 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" Name=3D"Medium Shading 2=
 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" Name=3D"Medium List 1 Ac=
cent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" Name=3D"Medium List 2 Ac=
cent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" Name=3D"Medium Grid 1 Ac=
cent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" Name=3D"Medium Grid 2 Ac=
cent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" Name=3D"Medium Grid 3 Ac=
cent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" Name=3D"Dark List Accent=
 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" Name=3D"Colorful Shading=
 Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" Name=3D"Colorful List Ac=
cent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" Name=3D"Colorful Grid Ac=
cent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" Name=3D"Light Shading Ac=
cent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" Name=3D"Light List Accen=
t 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" Name=3D"Light Grid Accen=
t 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" Name=3D"Medium Shading 1=
 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" Name=3D"Medium Shading 2=
 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" Name=3D"Medium List 1 Ac=
cent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" Name=3D"Medium List 2 Ac=
cent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" Name=3D"Medium Grid 1 Ac=
cent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" Name=3D"Medium Grid 2 Ac=
cent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" Name=3D"Medium Grid 3 Ac=
cent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" Name=3D"Dark List Accent=
 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" Name=3D"Colorful Shading=
 Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" Name=3D"Colorful List Ac=
cent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" Name=3D"Colorful Grid Ac=
cent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" Name=3D"Light Shading Ac=
cent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" Name=3D"Light List Accen=
t 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" Name=3D"Light Grid Accen=
t 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" Name=3D"Medium Shading 1=
 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" Name=3D"Medium Shading 2=
 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" Name=3D"Medium List 1 Ac=
cent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" Name=3D"Medium List 2 Ac=
cent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" Name=3D"Medium Grid 1 Ac=
cent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" Name=3D"Medium Grid 2 Ac=
cent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" Name=3D"Medium Grid 3 Ac=
cent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" Name=3D"Dark List Accent=
 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" Name=3D"Colorful Shading=
 Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" Name=3D"Colorful List Ac=
cent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" Name=3D"Colorful Grid Ac=
cent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" Name=3D"Light Shading Ac=
cent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" Name=3D"Light List Accen=
t 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" Name=3D"Light Grid Accen=
t 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" Name=3D"Medium Shading 1=
 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" Name=3D"Medium Shading 2=
 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" Name=3D"Medium List 1 Ac=
cent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" Name=3D"Medium List 2 Ac=
cent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" Name=3D"Medium Grid 1 Ac=
cent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" Name=3D"Medium Grid 2 Ac=
cent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" Name=3D"Medium Grid 3 Ac=
cent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" Name=3D"Dark List Accent=
 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" Name=3D"Colorful Shading=
 Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" Name=3D"Colorful List Ac=
cent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" Name=3D"Colorful Grid Ac=
cent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"60" Name=3D"Light Shading Ac=
cent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"61" Name=3D"Light List Accen=
t 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"62" Name=3D"Light Grid Accen=
t 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"63" Name=3D"Medium Shading 1=
 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"64" Name=3D"Medium Shading 2=
 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"65" Name=3D"Medium List 1 Ac=
cent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"66" Name=3D"Medium List 2 Ac=
cent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"67" Name=3D"Medium Grid 1 Ac=
cent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"68" Name=3D"Medium Grid 2 Ac=
cent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"69" Name=3D"Medium Grid 3 Ac=
cent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"70" Name=3D"Dark List Accent=
 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"71" Name=3D"Colorful Shading=
 Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"72" Name=3D"Colorful List Ac=
cent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"73" Name=3D"Colorful Grid Ac=
cent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"19" QFormat=3D"true"
   Name=3D"Subtle Emphasis"/>
  <w:LsdException Locked=3D"false" Priority=3D"21" QFormat=3D"true"
   Name=3D"Intense Emphasis"/>
  <w:LsdException Locked=3D"false" Priority=3D"31" QFormat=3D"true"
   Name=3D"Subtle Reference"/>
  <w:LsdException Locked=3D"false" Priority=3D"32" QFormat=3D"true"
   Name=3D"Intense Reference"/>
  <w:LsdException Locked=3D"false" Priority=3D"33" QFormat=3D"true" Name=3D=
"Book Title"/>
  <w:LsdException Locked=3D"false" Priority=3D"37" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" Name=3D"Bibliography"/>
  <w:LsdException Locked=3D"false" Priority=3D"39" SemiHidden=3D"true"
   UnhideWhenUsed=3D"true" QFormat=3D"true" Name=3D"TOC Heading"/>
  <w:LsdException Locked=3D"false" Priority=3D"41" Name=3D"Plain Table 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"42" Name=3D"Plain Table 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"43" Name=3D"Plain Table 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"44" Name=3D"Plain Table 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"45" Name=3D"Plain Table 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"40" Name=3D"Grid Table Light=
"/>
  <w:LsdException Locked=3D"false" Priority=3D"46" Name=3D"Grid Table 1 Lig=
ht"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"Grid Table 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"Grid Table 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"Grid Table 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"Grid Table 5 Dar=
k"/>
  <w:LsdException Locked=3D"false" Priority=3D"51" Name=3D"Grid Table 6 Col=
orful"/>
  <w:LsdException Locked=3D"false" Priority=3D"52" Name=3D"Grid Table 7 Col=
orful"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"Grid Table 1 Light Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"Grid Table 2 Acc=
ent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"Grid Table 3 Acc=
ent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"Grid Table 4 Acc=
ent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"Grid Table 5 Dar=
k Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"Grid Table 6 Colorful Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"Grid Table 7 Colorful Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"Grid Table 1 Light Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"Grid Table 2 Acc=
ent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"Grid Table 3 Acc=
ent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"Grid Table 4 Acc=
ent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"Grid Table 5 Dar=
k Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"Grid Table 6 Colorful Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"Grid Table 7 Colorful Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"Grid Table 1 Light Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"Grid Table 2 Acc=
ent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"Grid Table 3 Acc=
ent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"Grid Table 4 Acc=
ent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"Grid Table 5 Dar=
k Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"Grid Table 6 Colorful Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"Grid Table 7 Colorful Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"Grid Table 1 Light Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"Grid Table 2 Acc=
ent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"Grid Table 3 Acc=
ent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"Grid Table 4 Acc=
ent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"Grid Table 5 Dar=
k Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"Grid Table 6 Colorful Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"Grid Table 7 Colorful Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"Grid Table 1 Light Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"Grid Table 2 Acc=
ent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"Grid Table 3 Acc=
ent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"Grid Table 4 Acc=
ent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"Grid Table 5 Dar=
k Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"Grid Table 6 Colorful Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"Grid Table 7 Colorful Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"Grid Table 1 Light Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"Grid Table 2 Acc=
ent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"Grid Table 3 Acc=
ent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"Grid Table 4 Acc=
ent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"Grid Table 5 Dar=
k Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"Grid Table 6 Colorful Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"Grid Table 7 Colorful Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"46" Name=3D"List Table 1 Lig=
ht"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"List Table 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"List Table 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"List Table 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"List Table 5 Dar=
k"/>
  <w:LsdException Locked=3D"false" Priority=3D"51" Name=3D"List Table 6 Col=
orful"/>
  <w:LsdException Locked=3D"false" Priority=3D"52" Name=3D"List Table 7 Col=
orful"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"List Table 1 Light Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"List Table 2 Acc=
ent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"List Table 3 Acc=
ent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"List Table 4 Acc=
ent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"List Table 5 Dar=
k Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"List Table 6 Colorful Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"List Table 7 Colorful Accent 1"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"List Table 1 Light Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"List Table 2 Acc=
ent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"List Table 3 Acc=
ent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"List Table 4 Acc=
ent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"List Table 5 Dar=
k Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"List Table 6 Colorful Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"List Table 7 Colorful Accent 2"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"List Table 1 Light Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"List Table 2 Acc=
ent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"List Table 3 Acc=
ent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"List Table 4 Acc=
ent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"List Table 5 Dar=
k Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"List Table 6 Colorful Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"List Table 7 Colorful Accent 3"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"List Table 1 Light Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"List Table 2 Acc=
ent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"List Table 3 Acc=
ent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"List Table 4 Acc=
ent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"List Table 5 Dar=
k Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"List Table 6 Colorful Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"List Table 7 Colorful Accent 4"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"List Table 1 Light Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"List Table 2 Acc=
ent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"List Table 3 Acc=
ent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"List Table 4 Acc=
ent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"List Table 5 Dar=
k Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"List Table 6 Colorful Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"List Table 7 Colorful Accent 5"/>
  <w:LsdException Locked=3D"false" Priority=3D"46"
   Name=3D"List Table 1 Light Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"47" Name=3D"List Table 2 Acc=
ent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"48" Name=3D"List Table 3 Acc=
ent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"49" Name=3D"List Table 4 Acc=
ent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"50" Name=3D"List Table 5 Dar=
k Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"51"
   Name=3D"List Table 6 Colorful Accent 6"/>
  <w:LsdException Locked=3D"false" Priority=3D"52"
   Name=3D"List Table 7 Colorful Accent 6"/>
 </w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
 /* Style Definitions */
 table.MsoNormalTable
 {mso-style-name:"Table Normal";
 mso-tstyle-rowband-size:0;
 mso-tstyle-colband-size:0;
 mso-style-noshow:yes;
 mso-style-priority:99;
 mso-style-parent:"";
 mso-padding-alt:0in 5.4pt 0in 5.4pt;
 mso-para-margin-top:0in;
 mso-para-margin-right:0in;
 mso-para-margin-bottom:8.0pt;
 mso-para-margin-left:0in;
 line-height:107%;
 mso-pagination:widow-orphan;
 font-size:11.0pt;
 font-family:"Calibri",sans-serif;
 mso-ascii-font-family:Calibri;
 mso-ascii-theme-font:minor-latin;
 mso-hansi-font-family:Calibri;
 mso-hansi-theme-font:minor-latin;
 mso-bidi-font-family:"Times New Roman";
 mso-bidi-theme-font:minor-bidi;}
</style>
<![endif]--></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d9001051-0946-4dcf-bf78-8bcdb8302989%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d9001051-0946-4dcf-bf78-8bcdb8302989=
%40isocpp.org</a>.<br />

------=_Part_2953_1219705336.1504294124651--

------=_Part_2952_496205681.1504294124648--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 1 Sep 2017 22:35:02 +0300
Raw View
On 1 September 2017 at 22:28, Rich Sposato <rich.sposato@gmail.com> wrote:
> Hi,
>
> I wrote this proposal after discovering the std::bad_alloc exception class
> only has a default constructor. Other exception classes have constructors
> with a string parameter. The lack of a similar constructor in bad_alloc has
> caused problems for me.
>
> This is the second draft of this proposal. Please provide feedback on how to
> improve it before I submit it.
>
> I would especially prefer feedback on wording and style so that it conforms
> with the wording and style of accepted proposals. I would also like feedback
> on technical correctness.


I have a technical question. The proposed signatures look like
bad_alloc needs to store a copy of
the data passed as an argument for the constructor. How likely is
storing that copy to fail right
after an allocation failure?

I have a follow-up question: did you consider the alternative where
the caller of the new constructor must pass an rvalue reference
to a std::string, in which case there would be most likely a much
smaller allocation, as in the case of a dynamically
allocated string that doesn't fit into SSO, there would be none, and
in the SSO case, a very small allocation that
is not dynamic?

Another question I have is this: what sort of ABI impact will this
change have for existing standard library implementations?

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUaAOnPnLsUc5SpycK9dTpeT60%2BVt0dQFbSPMROb7JCf0w%40mail.gmail.com.

.


Author: Nevin Liber <nevin@eviloverlord.com>
Date: Fri, 01 Sep 2017 20:42:08 +0000
Raw View
--f403045c31481070d3055826cc54
Content-Type: text/plain; charset="UTF-8"

On Fri, Sep 1, 2017 at 2:35 PM, Ville Voutilainen <
ville.voutilainen@gmail.com> wrote:

> I have a technical question. The proposed signatures look like
> bad_alloc needs to store a copy of
> the data passed as an argument for the constructor. How likely is
> storing that copy to fail right
> after an allocation failure?
>

You beat me to asking this question. :-)


> I have a follow-up question: did you consider the alternative where
> the caller of the new constructor must pass an rvalue reference
> to a std::string, in which case there would be most likely a much
> smaller allocation, as in the case of a dynamically
> allocated string that doesn't fit into SSO, there would be none, and
> in the SSO case, a very small allocation that
> is not dynamic?
>

I don't think an rvalue reference to a std::string helps.  As was recently
pointed out to me [exception]p2: 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. <http://eel.is/c++draft/exception#2.sentence-1>

std::string doesn't meet that requirement (and cannot, since we effectively
no long allow a reference counted std::string implementation as of C++11),
so bad_alloc cannot hold one.

I suppose it could hold a shared_ptr<string>, but then we have to allocate
the shared_ptr...

Another question I have is this: what sort of ABI impact will this
> change have for existing standard library implementations?
>

+1 as well.
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  +1-847-691-1404
--
 Nevin ":-)" Liber  <mailto:nevin@eviloverlord.com>  +1-847-691-1404

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BP1nWqSwTQWAWt8jJ6YEM7zKjDp1xzK56OT%2BiAc5ayzhQ%40mail.gmail.com.

--f403045c31481070d3055826cc54
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div><div>On Fri, Sep 1, 2017 at 2:35 PM, Ville Voutilainen <span>&lt;<a hr=
ef=3D"mailto:ville.voutilainen@gmail.com" target=3D"_blank">ville.voutilain=
en@gmail.com</a>&gt;</span> wrote:<br></div><div><div class=3D"gmail_extra"=
><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=3D"marg=
in:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-l=
eft-color:rgb(204,204,204);padding-left:1ex">I have a technical question. T=
he proposed signatures look like<br>
bad_alloc needs to store a copy of<br>
the data passed as an argument for the constructor. How likely is<br>
storing that copy to fail right<br>
after an allocation failure?<br></blockquote><div><br></div></div></div></d=
iv></div><div><div><div class=3D"gmail_extra"><div class=3D"gmail_quote"><d=
iv>You beat me to asking this question. :-)</div></div></div></div></div><d=
iv><div><div class=3D"gmail_extra"><div class=3D"gmail_quote"><div>=C2=A0</=
div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;bor=
der-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,20=
4);padding-left:1ex">I have a follow-up question: did you consider the alte=
rnative where<br>
the caller of the new constructor must pass an rvalue reference<br>
to a std::string, in which case there would be most likely a much<br>
smaller allocation, as in the case of a dynamically<br>
allocated string that doesn&#39;t fit into SSO, there would be none, and<br=
>
in the SSO case, a very small allocation that<br>
is not dynamic?<br></blockquote><div><br></div></div></div></div></div><div=
><div><div class=3D"gmail_extra"><div class=3D"gmail_quote"><div>I don&#39;=
t think an rvalue reference to a std::string helps.=C2=A0 As was recently p=
ointed out to me [exception]p2:=C2=A0<span style=3D"color:rgb(0,0,0);font-f=
amily:serif;font-size:medium;text-align:justify">Each standard library clas=
s=C2=A0</span><span class=3D"m_-3903185137290959039gmail-texttt" style=3D"f=
ont-family:monospace;color:rgb(0,0,0);text-align:justify">T</span><span sty=
le=3D"color:rgb(0,0,0);font-family:serif;font-size:medium;text-align:justif=
y">=C2=A0that derives from class=C2=A0</span><span class=3D"m_-390318513729=
0959039gmail-texttt" style=3D"font-family:monospace;color:rgb(0,0,0);text-a=
lign:justify">exception</span><span style=3D"color:rgb(0,0,0);font-family:s=
erif;font-size:medium;text-align:justify">=C2=A0shall have a publicly acces=
sible copy constructor and a publicly accessible copy assignment operator t=
hat do not exit with an exception</span><a class=3D"m_-3903185137290959039g=
mail-hidden_link" href=3D"http://eel.is/c++draft/exception#2.sentence-1" st=
yle=3D"text-decoration:none;color:inherit;font-family:serif;text-align:just=
ify" target=3D"_blank">.</a></div><div><br></div><div>std::string doesn&#39=
;t meet that requirement (and cannot, since we effectively no long allow a =
reference counted std::string implementation as of C++11), so bad_alloc can=
not hold one.</div><div><br></div><div>I suppose it could hold a shared_ptr=
&lt;string&gt;, but then we have to allocate the shared_ptr...</div></div><=
/div></div></div><div><div><div class=3D"gmail_extra"><div class=3D"gmail_q=
uote"><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px =
0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-col=
or:rgb(204,204,204);padding-left:1ex">Another question I have is this: what=
 sort of ABI impact will this<br>
change have for existing standard library implementations?<br></blockquote>=
<div><br></div></div></div></div></div><div><div><div class=3D"gmail_extra"=
><div class=3D"gmail_quote"><div>+1 as well.</div></div></div></div></div><=
div><div><div class=3D"gmail_extra">-- <br><div class=3D"m_-390318513729095=
9039gmail_signature"><div><div><div><div>=C2=A0Nevin &quot;:-)&quot; Liber=
=C2=A0 &lt;mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=3D"_blan=
k">nevin@eviloverlord.com</a>&gt; =C2=A0+1-847-691-1404</div></div></div></=
div></div>
</div></div></div><div dir=3D"ltr">-- <br></div><div class=3D"gmail_signatu=
re" data-smartmail=3D"gmail_signature"><div dir=3D"ltr"><div><div dir=3D"lt=
r"><div>=C2=A0Nevin &quot;:-)&quot; Liber=C2=A0 &lt;mailto:<a href=3D"mailt=
o:nevin@eviloverlord.com" target=3D"_blank">nevin@eviloverlord.com</a>&gt; =
=C2=A0+1-847-691-1404</div></div></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BP1nWqSwTQWAWt8jJ6YEM7zKjDp1x=
zK56OT%2BiAc5ayzhQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAGg_6%2BP1nW=
qSwTQWAWt8jJ6YEM7zKjDp1xzK56OT%2BiAc5ayzhQ%40mail.gmail.com</a>.<br />

--f403045c31481070d3055826cc54--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Fri, 1 Sep 2017 23:45:34 +0300
Raw View
On 1 September 2017 at 23:42, Nevin Liber <nevin@eviloverlord.com> wrote:
>> I have a follow-up question: did you consider the alternative where
>> the caller of the new constructor must pass an rvalue reference
>> to a std::string, in which case there would be most likely a much
>> smaller allocation, as in the case of a dynamically
>> allocated string that doesn't fit into SSO, there would be none, and
>> in the SSO case, a very small allocation that
>> is not dynamic?
>
>
> I don't think an rvalue reference to a std::string helps.  As was recently
> pointed out to me [exception]p2: 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.
>
> std::string doesn't meet that requirement (and cannot, since we effectively
> no long allow a reference counted std::string implementation as of C++11),
> so bad_alloc cannot hold one.

Just make the copy operation terminate() if it fails to copy a string.
;) Flippant ideas
aside, this is a fairly important thing to consider in the scope of
this proposal, good
catc.. err, finding.

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUYH3MitS%2B1HXMJkBsRPAvyV4VaX%2BnxiNj00ozF%3DcbfwRQ%40mail.gmail.com.

.


Author: Thiago Macieira <thiago@macieira.org>
Date: Fri, 01 Sep 2017 13:57:02 -0700
Raw View
On Friday, 1 September 2017 12:28:44 PDT Rich Sposato wrote:
> Hi,
>=20
> I wrote this proposal after discovering the std::bad_alloc exception clas=
s
> <http://en.cppreference.com/w/cpp/memory/new/bad_alloc> only has a defaul=
t
> constructor. Other exception classes have constructors with a string
> parameter. The lack of a similar constructor in bad_alloc has caused
> problems for me.
>=20
> This is the second draft of this proposal. Please provide feedback on how
> to improve it before I submit it.

This breaks binary compatibility by changing the size of bad_alloc. So ther=
e=20
needs to be a VERY good reason for this to happen.

So, what problems were those that you faced? What messages had you wanted t=
o=20
include and couldn't? How would they be used?

> The two additional constructors will accept either a reference to const
> std::string or a pointer to a C-style string. These constructors will loo=
k
> identical to constructors in other exception classes.
>=20
> explicit bad_alloc( const std::string & what_arg );

This constructor has problems. If the string outlives the unwound scopes, t=
hen=20
you can call the constructor below. If it doesn't outlive, then it would me=
an=20
bad_alloc would need to allocate memory in response to failing to allocate=
=20
memory, which is nonsense.

> explicit bad_alloc( const char * what_arg );
>=20
>=20
> An alternate constructor would use a string_view parameter instead of
> either of the two above constructors.
>=20
> explicit bad_alloc( std::string_view what_arg );

This could work and be used in replacement of the const char * above.=20
Fortunately, strlen can't throw or cause further problems.

> *2.      **Ease of making templates that construct exceptions.*
> *3.      **Ease of deriving subclasses from exception classes.*
>=20
>=20
> Motivations #2 and #3 are related. They can be explained with a single
> example that uses both templates and inheritance to show why bad_alloc
> constructors should accept an explanatory string parameter.

You need to explain why you're deriing from bad_alloc in the first place.

> template < class ExceptionType >
> class SmartException
> {
> public:
>       SmartException( const char * message,
> unsigned int line, const char * function ) :
>=20
>             *ExceptionType( message ),*
>             line_( line ),
>             functionName_( function )
>       {}
>=20
>       // ... rest of class ...
> private:
>       unsigned int line_;
>       const char * functionName_;
> };
>=20
> The SmartException constructor will call a subclass constructor that
> accepts a string parameter. This works for most exceptions, but not
> bad_alloc.

Can't you specialise it as a member template with enable_if to take exactly=
=20
the same arguments of the class that you're deriving from?

> *4.      **Changes to C++17 new and delete operators.*
>=20
> There are several additional new and delete operators in the C++17
> standard. The additional operators all have a std::align_val_t parameter =
to
> support alignment-aware allocators. The std::align_val_t parameter will
> become part of class-specific new and delete operators along with the
> global operators.
>=20
>=20
> void * operator new( std::size_t count, std::align_val_t al);
>=20
> void * operator new[]( std::size_t count, std::align_val_t al);
>=20
> void operator delete( void * ptr, std::size_t sz, std::align_val_t al );
>=20
> void operator delete[]( void * ptr, std::size_t sz, std::align_val_t al )=
;
>=20
>=20
>=20
> Alignment-aware allocators would be unable to allocate the required numbe=
r
> of bytes if the alignment is incorrect. (e.g. =E2=80=93 The caller reques=
ts
> alignment on 16 byte boundaries, but the allocator only supports alignmen=
t
> on 4 or 8 byte boundaries.) If the allocator throws a bad_alloc exception
> for the invalid alignment, the caller may assume the program is out of
> memory instead of assuming the alignment is incorrect.

Maybe it should throw something different, like bad_alignment_argument (we=
=20
have bad_array_new_length). Though, to be honest, I wonder if it should thr=
ow=20
at all or if it should just abort execution. This is not a runtime conditio=
n,=20
this is a programming error.

> Such a caller may
> call a new_handler believing it will make more memory available. A
> new_handler could spend an enormous amount of time looking for memory tha=
t
> is available only to find none, simply throw another bad_alloc exception,
> or terminate the program by calling std::abort or std::exit. None of thes=
e
> actions will resolve the simple problem of using the correct alignment.

Agreed. That leads to the conclusion that throwing std::bad_alloc or callin=
g=20
new_handler in response to wrong alignment values is the wrong action to ta=
ke.

> This means that a bad_alloc exception with a valid explanatory string cou=
ld
> provide the caller with actionable information to solve the problem, whil=
e
> a bad_alloc exception with no (or an inaccurate) explanatory string would
> lead the caller to perform an expensive or program-ending action.

The string is the worst way to report this problem. Why would an exception=
=20
handler do a strcmp on what()? In fact, *what* would it strcmp to? If you'r=
e=20
going to distinguish, do it on the typeid, which is what catch() does.

> *5.      **Allowing allocators to inform callers exactly why allocations
> failed.*
>=20
>=20
> Allocations may fail for reasons other than the program ran out memory.
> There are specialized allocators that only handle requests for specific
> sizes, such as pool allocators, that could throw exceptions if they recei=
ve
> requests for sizes they cannot handle.

Same as alignment issue: the type of the thrown exception should be differe=
nt.

> 1.      Should the bad_alloc exception be used only allocators fail from
> lack of memory?

IMHO, yes.

> 2.      Can it also be used for allocations that fail because of invalid
> parameters (e.g. wrong size or alignment)?

No.

> 3.      Can it also be used for allocations that fail because of internal
> problems with the allocator?

No.

> However, many programmers write code assuming that allocators only throw
> bad_alloc. They do not expect to catch logic_error or invalid_argument
> exceptions, so these exceptions will propagate past the functions that
> should have caught them. For that reason, I recommend using bad_alloc for
> any problems that arise during allocations.

And well they shouldn't. As I said, those errors indicate programming error=
s,=20
not runtime conditions that can be handled.

--=20
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/5044931.e35jvUQpKU%40tjmaciei-mobl1.

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Sat, 2 Sep 2017 00:02:14 +0300
Raw View
On 1 September 2017 at 23:57, Thiago Macieira <thiago@macieira.org> wrote:
> On Friday, 1 September 2017 12:28:44 PDT Rich Sposato wrote:
>> Hi,
>>
>> I wrote this proposal after discovering the std::bad_alloc exception class
>> <http://en.cppreference.com/w/cpp/memory/new/bad_alloc> only has a default
>> constructor. Other exception classes have constructors with a string
>> parameter. The lack of a similar constructor in bad_alloc has caused
>> problems for me.
>>
>> This is the second draft of this proposal. Please provide feedback on how
>> to improve it before I submit it.
>
> This breaks binary compatibility by changing the size of bad_alloc. So there
> needs to be a VERY good reason for this to happen.

That means that at least one implementation vendor will oppose it (not
automatically just because,
but because that VERY good reason needs to be so strong that the
vendor goes "oh yeah
that's a bad bug that should've been fixed ages ago", and that's not
the case here), and that
at least two NBs will comment on it and that one of them will oppose
it before it can land.
This proposal is now fighting an uphill battle.

Why can't the problem be solved by a new exception type?

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAFk2RUY0h%2B%2BB%2BnMoG%2B-a1ujSu7qBN6DYOG7G31OjeJXnj4f2Qg%40mail.gmail.com.

.


Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Fri, 1 Sep 2017 15:49:44 -0700 (PDT)
Raw View
------=_Part_3136_1568527647.1504306184462
Content-Type: multipart/alternative;
 boundary="----=_Part_3137_967671686.1504306184462"

------=_Part_3137_967671686.1504306184462
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Friday, September 1, 2017 at 12:28:44 PM UTC-7, Rich Sposato wrote:
>
> Hi,
>
> I wrote this proposal after discovering the std::bad_alloc exception clas=
s=20
> <http://en.cppreference.com/w/cpp/memory/new/bad_alloc> only has a=20
> default constructor. Other exception classes have constructors with a=20
> string parameter. The lack of a similar constructor in bad_alloc has caus=
ed=20
> problems for me.
>

If you're going to claim that it "caused problems", you should mention some=
=20
of those problems, so that people can suggest alternative fixes.
My initial very strong impression is that you have an XY problem.

If you want to throw something that catches-like std::bad_alloc but also=20
includes some additional member data... well, that's what inheritance is=20
for.

class SmartBadAllocException : public std::bad_alloc {
    std::string what_;
public:
    SmartBadAllocException(const char *what) : what_(what) {}
    const char *what() const override { return what_.c_str(); }
};

Does this solve the problem you had?


1.      Should the bad_alloc exception be used only allocators fail from=20
> lack of memory?
>
> 2.      Can it also be used for allocations that fail because of invalid=
=20
> parameters (e.g. wrong size or alignment)?
>
> 3.      Can it also be used for allocations that fail because of internal=
=20
> problems with the allocator?
>

1. No, because (2).
2. Yes. I do this, for the reasons you stated below.
3. Yes, but "internal problems" suggests that an invariant failed, so I'd=
=20
rather throw AssertionFailure or just go undefined-behavior. Throwing=20
bad_alloc when an invariant has failed is probably going to hide the=20
problem, whereas the debugging human would really rather see it flagged=20
loudly.

One answer to the first and second questions is that allocators should=20
> throw an out_of_range or invalid_argument exception when the size or=20
> alignment parameter is invalid. Likewise, one could say allocators should=
=20
> throw logic_error or runtime_error for internal problems. These answers=
=20
> imply bad_alloc is reserved strictly for out of memory conditions, but no=
t=20
> for other conditions that arise during allocations.
>
>
> However, many programmers write code assuming that allocators only throw=
=20
> bad_alloc. They do not expect to catch logic_error or invalid_argument=20
> exceptions, so these exceptions will propagate past the functions that=20
> should have caught them. For that reason, I recommend using bad_alloc for=
=20
> any problems that arise during allocations.
>

I agree.

Pet peeve: The C++17 allocators such as std::pmr::monotonic_buffer_resource=
=20
do not throw anything on invalid/too-aligned alignment; instead, they=20
quietly return less-aligned pointers. If you're using one of these=20
allocators, you'd better be checking every allocation to make sure the=20
allocator didn't quietly give you a misaligned pointer! :P

=E2=80=93Arthur

>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/d5996110-3605-4a34-a660-223f38f980c8%40isocpp.or=
g.

------=_Part_3137_967671686.1504306184462
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, September 1, 2017 at 12:28:44 PM UTC-7, Rich Sp=
osato wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">H=
i,<br><br>I wrote this proposal after discovering <a href=3D"http://en.cppr=
eference.com/w/cpp/memory/new/bad_alloc" target=3D"_blank" rel=3D"nofollow"=
 onmousedown=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%=
2Fen.cppreference.com%2Fw%2Fcpp%2Fmemory%2Fnew%2Fbad_alloc\x26sa\x3dD\x26sn=
tz\x3d1\x26usg\x3dAFQjCNF_x-zQh7G-qzK-dR4S2BcsSJEXQA&#39;;return true;" onc=
lick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fen.cpp=
reference.com%2Fw%2Fcpp%2Fmemory%2Fnew%2Fbad_alloc\x26sa\x3dD\x26sntz\x3d1\=
x26usg\x3dAFQjCNF_x-zQh7G-qzK-dR4S2BcsSJEXQA&#39;;return true;">the std::ba=
d_alloc exception class</a> only has a default constructor. Other exception=
 classes have constructors with a string parameter. The lack of a similar c=
onstructor in bad_alloc has caused problems for me.<br></div></blockquote><=
div><br></div><div>If you&#39;re going to claim that it &quot;caused proble=
ms&quot;, you should mention some of those problems, so that people can sug=
gest alternative fixes.</div><div>My initial very strong impression is that=
 you have an XY problem.</div><div><br></div><div>If you want to throw some=
thing that catches-like std::bad_alloc but also includes some additional me=
mber data... well, that&#39;s what inheritance is for.</div><div><br></div>=
<div>class SmartBadAllocException : public std::bad_alloc {</div><div>=C2=
=A0 =C2=A0 std::string what_;</div><div>public:</div><div>=C2=A0 =C2=A0 Sma=
rtBadAllocException(const char *what) : what_(what) {}</div><div>=C2=A0 =C2=
=A0 const char *what() const override { return what_.c_str(); }</div><div>}=
;</div><div><br></div><div>Does this solve the problem you had?</div><div><=
br></div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: =
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div d=
ir=3D"ltr"><p class=3D"MsoNormal" style=3D"line-height:normal"><span style=
=3D"font-size: 12pt; font-family: &#39;Times New Roman&#39;, serif;">1.<spa=
n style=3D"font-size: 7pt; line-height: normal; font-family: &#39;Times New=
 Roman&#39;;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span><span style=3D"font-size: 12pt; font-family: &#39;Times New R=
oman&#39;, serif;">Should the bad_alloc exception be
used only allocators fail from lack of memory?</span><br></p>

<p style=3D"line-height:normal"><span style=3D"font-size:12.0pt;font-family=
:&quot;Times New Roman&quot;,serif"><span>2.<span style=3D"font:7.0pt &quot=
;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif">Can it also be used for allocations
that fail because of invalid parameters (e.g. wrong size or alignment)?</sp=
an></p>

<p style=3D"line-height:normal"><span style=3D"font-size:12.0pt;font-family=
:&quot;Times New Roman&quot;,serif"><span>3.<span style=3D"font:7.0pt &quot=
;Times New Roman&quot;">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif">Can it also be used for allocations
that fail because of internal problems with the allocator?</span></p></div>=
</blockquote><div><br></div><div>1. No, because (2).</div><div>2. Yes. I do=
 this, for the reasons you stated below.</div><div>3. Yes, but &quot;intern=
al problems&quot; suggests that an invariant failed, so I&#39;d rather thro=
w AssertionFailure or just go undefined-behavior. Throwing bad_alloc when a=
n invariant has failed is probably going to hide the problem, whereas the d=
ebugging human would really rather see it flagged loudly.</div><div><br></d=
iv><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;=
border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><p style=
=3D"line-height:normal"><span style=3D"font-family: &#39;Times New Roman&#3=
9;, serif; font-size: 12pt;">One answer to the first and second
questions is that allocators should throw an out_of_range or invalid_argume=
nt exception
when the size or alignment parameter is invalid. Likewise, one could say
allocators should throw logic_error or runtime_error for internal problems.
These answers imply bad_alloc is reserved strictly for out of memory
conditions, but not for other conditions that arise during allocations.</sp=
an><br></p><p class=3D"MsoNormal" style=3D"line-height:normal"><span style=
=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif"><br></s=
pan></p>

<p class=3D"MsoNormal" style=3D"line-height:normal"><span style=3D"font-siz=
e:12.0pt;font-family:&quot;Times New Roman&quot;,serif">However, many progr=
ammers write code
assuming that allocators only throw bad_alloc. They do not expect to catch =
logic_error
or invalid_argument exceptions, so these exceptions will propagate past the
functions that should have caught them. For that reason, I recommend using
bad_alloc for any problems that arise during allocations.</span></p></div><=
/blockquote><div><br></div><div>I agree.</div><div><br></div><div>Pet peeve=
: The C++17 allocators such as std::pmr::monotonic_buffer_resource do not t=
hrow anything on invalid/too-aligned alignment; instead, they quietly retur=
n less-aligned pointers. If you&#39;re using one of these allocators, you&#=
39;d better be checking every allocation to make sure the allocator didn&#3=
9;t quietly give you a misaligned pointer! :P</div><div><br></div><div>=E2=
=80=93Arthur</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr">

</div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d5996110-3605-4a34-a660-223f38f980c8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d5996110-3605-4a34-a660-223f38f980c8=
%40isocpp.org</a>.<br />

------=_Part_3137_967671686.1504306184462--

------=_Part_3136_1568527647.1504306184462--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 1 Sep 2017 16:04:17 -0700 (PDT)
Raw View
------=_Part_3111_1365216330.1504307057642
Content-Type: multipart/alternative;
 boundary="----=_Part_3112_740863468.1504307057644"

------=_Part_3112_740863468.1504307057644
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

On Friday, September 1, 2017 at 3:28:44 PM UTC-4, Rich Sposato wrote:
>
> III.  Motivation=20
>
>
> There are several motivations for this proposal. Each of these will be=20
> described in detail.
>
> 1.      Conformance to existing exception classes.
>
> 2.      Ease of making templates that construct exceptions.
>
> 3.      Ease of deriving subclasses from exception classes.
>
> 4.      Changes to C++17 new and delete operators.
>
> 5.      Allowing allocators to inform callers exactly why allocations=20
> failed.
>

Overall, I find your proposal poorly motivated. See below for details. But=
=20
this proposal needs better motivation for its existence.
=20

>  1*.      **Conformance to existing exception classes.*
>
>
> All other exception classes in the std namespace provide constructors tha=
t=20
> accept either a single parameter of either a reference to a const=20
> std::string or a pointer to a C-style string. The parameter provides a=20
> human-readable explanation for why the program threw an exception or=20
> actionable information allowing the calling code to correct the problem.
>
> =C2=B7         logic_error
>
> =C2=B7         invalid_argument
>
> =C2=B7         domain_error
>
> =C2=B7         length_error
>
> =C2=B7         out_of_range
>
> =C2=B7         runtime_error
>
> =C2=B7         range_error
>
> =C2=B7         overflow_error
>
> =C2=B7         underflow_error
>
> =C2=B7         tx_exception
>
>
> Conformance to other exception classes will enable motivations two and=20
> three for this proposal.
>

As others have pointed out, `std::bad_alloc` is special because it is due=
=20
to exactly the kind of failure that your API simply cannot handle: the=20
ability to allocate memory.

For the rest of my examinations, I will assume that the API is such that it=
=20
takes a bare `const char*`, and passes it on directly, with the expectation=
=20
being that you will ensure that the memory being pointed to will live to=20
the catch site. Because without that, I'm fairly sure your proposal is=20
essentially DOA.

*2.      **Ease of making templates that construct exceptions.*
>
> *3.      **Ease of deriving subclasses from exception classes.*
>
>
> Motivations #2 and #3 are related.
>
They can be explained with a single example that uses both templates and=20
> inheritance to show why bad_alloc constructors should accept an explanato=
ry=20
> string parameter.
>
>
> Classes that derive from the standard exceptions cannot call the bad_allo=
c=20
> constructor using the same code they would to call other exception classe=
s.=20
> This example illustrates how to wrap existing exception classes with a=20
> smart-exception class that derives from standard exceptions.
>
>
> template < class ExceptionType >
>
> class SmartException
>
> {
>
> public:
>
>       SmartException( const char * message,
>
> unsigned int line, const char * function ) :
>
>             *ExceptionType( message ),*
>
>             line_( line ),
>
>             functionName_( function )
>
>       {}
>
>       // ... rest of class ...
>
> private:
>
>       unsigned int line_;
>
>       const char * functionName_;
>
> };
>
>
> The SmartException constructor will call a subclass constructor that=20
> accepts a string parameter. This works for most exceptions, but not=20
> bad_alloc.
>

Here's a much better version, one that can work with *any* exception class=
=20
type, not just the ones that take a string:

template<class Exception>
class LocalizedException : Exception
{
  template<typename ...Args>
  LocalizedException(unsigned int line, const char * function, Args &&args)

    : Exception(std::forward<Args>(args)...)
    , line_(line)
    , function_(function)

  {}

};

Now, isn't that much better? You're not forcing yourself into this=20
erroneous "all exceptions take strings when constructed" assumption. You=20
can work with other types, those that have their own messages or whatever.

*4.      **Changes to C++17 new and delete operators.*
>
>
> There are several additional new and delete operators in the C++17=20
> standard. The additional operators all have a std::align_val_t parameter =
to=20
> support alignment-aware allocators. The std::align_val_t parameter will=
=20
> become part of class-specific new and delete operators along with the=20
> global operators.
>
>
> void * operator new( std::size_t count, std::align_val_t al);
>
> void * operator new[]( std::size_t count, std::align_val_t al);
>
> void operator delete( void * ptr, std::size_t sz, std::align_val_t al );
>
> void operator delete[]( void * ptr, std::size_t sz, std::align_val_t al )=
;
>
> =20
>
> Alignment-aware allocators would be unable to allocate the required numbe=
r=20
> of bytes if the alignment is incorrect. (e.g. =E2=80=93 The caller reques=
ts=20
> alignment on 16 byte boundaries, but the allocator only supports alignmen=
t=20
> on 4 or 8 byte boundaries.) If the allocator throws a bad_alloc exception=
=20
> for the invalid alignment, the caller may assume the program is out of=20
> memory instead of assuming the alignment is incorrect. Such a caller may=
=20
> call a new_handler believing it will make more memory available. A=20
> new_handler could spend an enormous amount of time looking for memory tha=
t=20
> is available only to find none, simply throw another bad_alloc exception,=
=20
> or terminate the program by calling std::abort or std::exit. None of thes=
e=20
> actions will resolve the simple problem of using the correct alignment.
>

That sounds like a good reason to separate `bad_alloc` from=20
`bad_alignment`. What we *don't* want is for users to try to do this:

catch(std::bad_alloc &e)
{
  if(e.what() =3D=3D ...)
  {
    //Handle bad alignment
  }
  else
  {
    //Handle OOM.
  }
}

That's two catch statements macarading as one. That's bad coding.
=20

> *5.      **Allowing allocators to inform callers exactly why allocations=
=20
> failed.*
>
>
> Allocations may fail for reasons other than the program ran out memory.=
=20
> There are specialized allocators that only handle requests for specific=
=20
> sizes, such as pool allocators, that could throw exceptions if they recei=
ve=20
> requests for sizes they cannot handle.
>
>
> This example shows how an allocator might throw a bad_alloc exception wit=
h=20
> actionable information.
>
>
> void * PoolAllocator::Allocate( std::size_t bytes, std::align_val_t=20
> alignment )
>
> {
>
>       if ( ( bytes < minAllowedSize ) || ( maxAllowedSize < bytes ) )
>
>       {
>
>             throw *SmartBadAllocException(*
>
> *=E2=80=9CError! This allocator only handles allocations from 16 through =
64 bytes=20
> in size.=E2=80=9D, __LINE__, __FUNCTION__ );*
>
>       }
>
>       if ( !IsValidAlignment( alignment ) )
>
>       {
>
>             throw *SmartBadAllocException(*
>
> *=E2=80=9CError! This allocator only handles alignments on 4 byte boundar=
ies.=E2=80=9D,=20
> __LINE__, __FUNCTION__ );*
>
>       }
>
>       void * place =3D FindPlace( bytes, alignment );
>
>       if ( place =3D=3D nullptr )
>
>       {
>
>             throw SmartBadAlloc( =E2=80=9CError! Unable to allocate bytes=
..=E2=80=9D,
>
>                   __LINE__, __FUNCTION__ );
>
>       }
>
>       return place;
>
> }
>

Unless you write an English language parser to figure out what those mean,=
=20
the only "actionable" thing that can be done is by the *programmer* (aka:=
=20
spitting the message out to the log), not by the program itself.

The only way to make this detectable by the program itself is to have it=20
throw something other than (or more than) `bad_alloc`. None of which=20
requires playing games with its string.
=20

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/42389eb4-97a9-4a1d-bbfb-c653ba62097f%40isocpp.or=
g.

------=_Part_3112_740863468.1504307057644
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, September 1, 2017 at 3:28:44 PM UTC-4, Rich Spo=
sato wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left=
: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;" zoompage-fontsize=
=3D"13"><div dir=3D"ltr" zoompage-fontsize=3D"13"><h1 zoompage-fontsize=3D"=
16"><a name=3D"d9001051-0946-4dcf-bf78-8bcdb8302989@isocpp.org__Toc49203062=
9" zoompage-fontsize=3D"16"><span zoompage-fontsize=3D"16"><span zoompage-f=
ontsize=3D"16">III.<span style=3D"font:7.0pt &quot;Times New Roman&quot;" z=
oompage-fontsize=3D"9">=C2=A0 </span></span></span><span zoompage-fontsize=
=3D"16">Motivation</span></a><span zoompage-fontsize=3D"16"></span></h1>

<p class=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13=
"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,s=
erif" zoompage-fontsize=3D"16"><br></span></p><p class=3D"MsoNormal" style=
=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:1=
2.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"1=
6">There are several motivations for
this proposal. Each of these will be described in detail.</span></p>

<p style=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"fon=
t-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fonts=
ize=3D"16"><span zoompage-fontsize=3D"16">1.<span style=3D"font:7.0pt &quot=
;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif" zoompage-fontsize=3D"16">Conformance to existing e=
xception
classes.</span></p>

<p style=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"fon=
t-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fonts=
ize=3D"16"><span zoompage-fontsize=3D"16">2.<span style=3D"font:7.0pt &quot=
;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif" zoompage-fontsize=3D"16">Ease of making templates =
that
construct exceptions.</span></p>

<p style=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"fon=
t-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fonts=
ize=3D"16"><span zoompage-fontsize=3D"16">3.<span style=3D"font:7.0pt &quot=
;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif" zoompage-fontsize=3D"16">Ease of deriving subclass=
es from
exception classes.</span></p>

<p style=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"fon=
t-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fonts=
ize=3D"16"><span zoompage-fontsize=3D"16">4.<span style=3D"font:7.0pt &quot=
;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif" zoompage-fontsize=3D"16">Changes to C++17 new and =
delete
operators.</span></p>

<p style=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"fon=
t-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fonts=
ize=3D"16"><span zoompage-fontsize=3D"16">5.<span style=3D"font:7.0pt &quot=
;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0
</span></span></span><span style=3D"font-size:12.0pt;font-family:&quot;Time=
s New Roman&quot;,serif" zoompage-fontsize=3D"16">Allowing allocators to in=
form
callers exactly why allocations failed.</span></p></div></blockquote><div z=
oompage-fontsize=3D"13"><br></div><div zoompage-fontsize=3D"13">Overall, I =
find your proposal poorly motivated. See below for details. But this propos=
al needs better motivation for its existence.<br></div><div zoompage-fontsi=
ze=3D"13">=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;=
margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;" zoompage=
-fontsize=3D"13"><div dir=3D"ltr" zoompage-fontsize=3D"13">

<p style=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"fon=
t-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fonts=
ize=3D"16">=C2=A0</span>1<b zoompage-fontsize=3D"13"><span style=3D"font-si=
ze:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=
=3D"16"><span zoompage-fontsize=3D"16">.<span style=3D"font:7.0pt &quot;Tim=
es New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span></b><b zoompage-fontsize=3D"13"><span style=3D"font-si=
ze:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=
=3D"16">Conformance to existing exception classes.</span></b></p>

<p class=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13=
"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,s=
erif" zoompage-fontsize=3D"16"><br></span></p><p class=3D"MsoNormal" style=
=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:1=
2.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"1=
6">All other exception classes in the std
namespace provide constructors that accept either a single parameter of eit=
her
a reference to a const std::string or a pointer to a C-style string. The
parameter provides a human-readable explanation for why the program threw a=
n
exception or actionable information allowing the calling code to correct th=
e
problem.</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">logic_error</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">invalid_argument</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">domain_error</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">length_error</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">out_of_range</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">runtime_error</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">range_error</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">overflow_error</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">underflow_error</span></p>

<p style=3D"margin-bottom:0in;margin-bottom:.0001pt;line-height:normal" zoo=
mpage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-family:Symbol" z=
oompage-fontsize=3D"13"><span zoompage-fontsize=3D"13">=C2=B7<span style=3D=
"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span><span style=3D"font-size:10.0pt;font-family:&quot;Cour=
ier New&quot;" zoompage-fontsize=3D"13">tx_exception</span></p>

<p class=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13=
"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,s=
erif" zoompage-fontsize=3D"16"><br></span></p><p class=3D"MsoNormal" style=
=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:1=
2.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"1=
6">Conformance to other exception
classes will enable motivations two and three for this proposal.</span></p>=
</div></blockquote><div zoompage-fontsize=3D"13"><br></div><div zoompage-fo=
ntsize=3D"13">As others have pointed out, `std::bad_alloc` is special becau=
se it is due to exactly the kind of failure that your API simply cannot han=
dle: the ability to allocate memory.</div><div zoompage-fontsize=3D"13"><br=
></div><div zoompage-fontsize=3D"13">For the rest of my examinations, I wil=
l assume that the API is such that it takes a bare `const char*`, and passe=
s it on directly, with the expectation being that you will ensure that the =
memory being pointed to will live to the catch site. Because without that, =
I&#39;m fairly sure your proposal is essentially DOA.<br></div><div zoompag=
e-fontsize=3D"13"><br></div><blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;" zo=
ompage-fontsize=3D"13"><div dir=3D"ltr" zoompage-fontsize=3D"13">

<p class=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13=
"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,s=
erif" zoompage-fontsize=3D"16"></span></p>

<p style=3D"line-height:normal" zoompage-fontsize=3D"13"><b zoompage-fontsi=
ze=3D"13"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman=
&quot;,serif" zoompage-fontsize=3D"16"><span zoompage-fontsize=3D"16">2.<sp=
an style=3D"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9"=
>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span></b><b zoompage-fontsize=3D"13"><span style=3D"font-si=
ze:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=
=3D"16">Ease of making templates that construct exceptions.</span></b></p>

<p style=3D"line-height:normal" zoompage-fontsize=3D"13"><b zoompage-fontsi=
ze=3D"13"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman=
&quot;,serif" zoompage-fontsize=3D"16"><span zoompage-fontsize=3D"16">3.<sp=
an style=3D"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9"=
>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span></b><b zoompage-fontsize=3D"13"><span style=3D"font-si=
ze:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=
=3D"16">Ease of deriving subclasses from exception classes.</span></b></p>

<p class=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13=
"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,s=
erif" zoompage-fontsize=3D"16"><br></span></p><p class=3D"MsoNormal" style=
=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:1=
2.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"1=
6">Motivations #2 and #3 are related.</span></p></div></blockquote><div zoo=
mpage-fontsize=3D"13"></div><blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;" zo=
ompage-fontsize=3D"13"><div dir=3D"ltr" zoompage-fontsize=3D"13"><p class=
=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13"><span =
style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zo=
ompage-fontsize=3D"16">They can be explained with a single example that use=
s both templates and
inheritance to show why bad_alloc constructors should accept an explanatory
string parameter.</span></p>

<p class=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13=
"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,s=
erif" zoompage-fontsize=3D"16"><br></span></p><p class=3D"MsoNormal" style=
=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:1=
2.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"1=
6">Classes that derive from the
standard exceptions cannot call the bad_alloc constructor using the same co=
de
they would to call other exception classes. This example illustrates how to=
 wrap
existing exception classes with a smart-exception class that derives from
standard exceptions.</span></p><p class=3D"MsoNormal" style=3D"line-height:=
normal" zoompage-fontsize=3D"13"><span style=3D"font-size:12.0pt;font-famil=
y:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"16"><br></span></=
p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">template &lt; =
class
ExceptionType &gt;</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">class SmartExc=
eption</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">{</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">public:</span>=
</p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>SmartException( cons=
t char * message,</span></p>

<p class=3D"MsoNormal" style=3D"margin-top:0in;margin-right:0in;margin-bott=
om:0in;margin-left:.5in;margin-bottom:.0001pt;text-indent:.5in;line-height:=
normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;font-famil=
y:&quot;Courier New&quot;" zoompage-fontsize=3D"13">unsigned int line, cons=
t char *
function ) :</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 </span><b zoompage-fontsize=3D"13"><span style=3D"color:red" zoom=
page-fontsize=3D"13">ExceptionType( message ),</span></b></span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 </span>line_( line ),</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 </span>functionName_( function )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>{}</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>// ... rest of class=
 ...</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">private:</span=
></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>unsigned int line_;<=
/span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>const char * functio=
nName_;</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">};</span></p>

<p class=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13=
"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,s=
erif" zoompage-fontsize=3D"16"><br></span></p><p class=3D"MsoNormal" style=
=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:1=
2.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"1=
6">The SmartException constructor will
call a subclass constructor that accepts a string parameter. This works for
most exceptions, but not bad_alloc.</span></p></div></blockquote><div zoomp=
age-fontsize=3D"13"><br></div><div zoompage-fontsize=3D"13">Here&#39;s a mu=
ch better version, one that can work with <i zoompage-fontsize=3D"13">any</=
i> exception class type, not just the ones that take a string:</div><div zo=
ompage-fontsize=3D"13"><br></div><div style=3D"background-color: rgb(250, 2=
50, 250); border-color: rgb(187, 187, 187); border-style: solid; border-wid=
th: 1px; overflow-wrap: break-word;" class=3D"prettyprint" zoompage-fontsiz=
e=3D"13"><code class=3D"prettyprint" zoompage-fontsize=3D"13"><div class=3D=
"subprettyprint" zoompage-fontsize=3D"13"><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">template</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pretti=
fy">Exception</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
></span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">LocalizedException</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Exception</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">template</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">.=
...</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Args</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">&gt;</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">LocalizedException<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">unsigned</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> line</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"style=
d-by-prettify">const</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify"=
>char</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">function</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">Args</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">&amp;&amp;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">args</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
span><span style=3D"color: #606;" class=3D"styled-by-prettify">Exception</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify">std</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">forward</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">&lt;</span><span style=3D"color: #606;"=
 class=3D"styled-by-prettify">Args</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">&gt;(</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">args</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">)...)</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> line_</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify">line</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> function_</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">function</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br><br>=C2=A0 </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">{}</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">};</span></div></code></div><div zoompage-fonts=
ize=3D"13"><br></div><div zoompage-fontsize=3D"13"></div><div zoompage-font=
size=3D"13">Now, isn&#39;t that much better? You&#39;re not forcing yoursel=
f into this erroneous &quot;all exceptions take strings when constructed&qu=
ot; assumption. You can work with other types, those that have their own me=
ssages or whatever.<br></div><div zoompage-fontsize=3D"13"><br></div><block=
quote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-le=
ft: 1px #ccc solid;padding-left: 1ex;" zoompage-fontsize=3D"13"><div dir=3D=
"ltr" zoompage-fontsize=3D"13"><p class=3D"MsoNormal" style=3D"line-height:=
normal" zoompage-fontsize=3D"13"><span style=3D"font-size:12.0pt;font-famil=
y:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"16"></span></p>

<p style=3D"line-height:normal" zoompage-fontsize=3D"13"><b zoompage-fontsi=
ze=3D"13"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman=
&quot;,serif" zoompage-fontsize=3D"16"><span zoompage-fontsize=3D"16">4.<sp=
an style=3D"font:7.0pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9"=
>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
</span></span></span></b><b zoompage-fontsize=3D"13"><span style=3D"font-si=
ze:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=
=3D"16">Changes to C++17 new and delete operators.</span></b></p>

<p class=3D"MsoNormal" zoompage-fontsize=3D"13"><span style=3D"font-size:12=
..0pt;line-height:107%;font-family:&quot;Times New Roman&quot;,serif" zoompa=
ge-fontsize=3D"16"><br></span></p><p class=3D"MsoNormal" zoompage-fontsize=
=3D"13"><span style=3D"font-size:12.0pt;line-height:107%;font-family:&quot;=
Times New Roman&quot;,serif" zoompage-fontsize=3D"16">There are
several additional new and delete operators in the C++17 standard. The
additional operators all have a std::align_val_t parameter to support
alignment-aware allocators. The std::align_val_t parameter will become part=
 of
class-specific new and delete operators along with the global operators.</s=
pan></p><p class=3D"MsoNormal" zoompage-fontsize=3D"13"><span style=3D"font=
-size:12.0pt;line-height:107%;font-family:&quot;Times New Roman&quot;,serif=
" zoompage-fontsize=3D"16"><br></span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt" zo=
ompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;line-height:107%;fon=
t-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">void * operator =
new(
std::size_t count, std::align_val_t al);</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt" zo=
ompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;line-height:107%;fon=
t-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">void * operator =
new[](
std::size_t count, std::align_val_t al);</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">void operator =
delete( void
* ptr, std::size_t sz, std::align_val_t al );</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">void operator
delete[]( void * ptr, std::size_t sz, std::align_val_t al );</span></p>

<p class=3D"MsoNormal" zoompage-fontsize=3D"13"><span style=3D"font-size:12=
..0pt;line-height:107%;font-family:&quot;Times New Roman&quot;,serif" zoompa=
ge-fontsize=3D"16">=C2=A0</span></p>

<p class=3D"MsoNormal" zoompage-fontsize=3D"13"><span style=3D"font-size:12=
..0pt;line-height:107%;font-family:&quot;Times New Roman&quot;,serif" zoompa=
ge-fontsize=3D"16">Alignment-aware
allocators would be unable to allocate the required number of bytes if the
alignment is incorrect. (e.g. =E2=80=93 The caller requests alignment on 16=
 byte
boundaries, but the allocator only supports alignment on 4 or 8 byte
boundaries.) If the allocator throws a bad_alloc exception for the invalid
alignment, the caller may assume the program is out of memory instead of
assuming the alignment is incorrect. Such a caller may call a new_handler b=
elieving
it will make more memory available. A new_handler could spend an enormous
amount of time looking for memory that is available only to find none, simp=
ly
throw another bad_alloc exception, or terminate the program by calling
std::abort or std::exit. None of these actions will resolve the simple prob=
lem
of using the correct alignment.</span></p></div></blockquote><div zoompage-=
fontsize=3D"13"><br></div><div zoompage-fontsize=3D"13">That sounds like a =
good reason to separate `bad_alloc` from `bad_alignment`. What we <i zoompa=
ge-fontsize=3D"13">don&#39;t</i> want is for users to try to do this:</div>=
<div zoompage-fontsize=3D"13"><br></div><div style=3D"background-color: rgb=
(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; bor=
der-width: 1px; overflow-wrap: break-word;" class=3D"prettyprint" zoompage-=
fontsize=3D"13"><code class=3D"prettyprint" zoompage-fontsize=3D"13"><div c=
lass=3D"subprettyprint" zoompage-fontsize=3D"13"><span style=3D"color: #008=
;" class=3D"styled-by-prettify">catch</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">std</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">bad_alloc </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">&amp;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">e<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">if</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">e</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">what</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
()</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">=3D=3D</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">...)</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"co=
lor: #800;" class=3D"styled-by-prettify">//Handle bad alignment</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">else</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"c=
olor: #800;" class=3D"styled-by-prettify">//Handle OOM.</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></div></code></div><div zoompage-fontsiz=
e=3D"13"><br>That&#39;s two catch statements macarading as one. That&#39;s =
bad coding.<br></div><div zoompage-fontsize=3D"13">=C2=A0</div><blockquote =
class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1p=
x #ccc solid;padding-left: 1ex;" zoompage-fontsize=3D"13"><div dir=3D"ltr" =
zoompage-fontsize=3D"13"><p class=3D"MsoNormal" zoompage-fontsize=3D"13"><s=
pan style=3D"font-size:12.0pt;line-height:107%;font-family:&quot;Times New =
Roman&quot;,serif" zoompage-fontsize=3D"16"></span></p><p style=3D"line-hei=
ght:normal" zoompage-fontsize=3D"13"><b zoompage-fontsize=3D"13"><span styl=
e=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompa=
ge-fontsize=3D"16"><span zoompage-fontsize=3D"16">5.<span style=3D"font:7.0=
pt &quot;Times New Roman&quot;" zoompage-fontsize=3D"9">=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0
</span></span></span></b><b zoompage-fontsize=3D"13"><span style=3D"font-si=
ze:12.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=
=3D"16">Allowing allocators to inform callers exactly why
allocations failed.</span></b></p>

<p class=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13=
"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,s=
erif" zoompage-fontsize=3D"16"><br></span></p><p class=3D"MsoNormal" style=
=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:1=
2.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"1=
6">Allocations may fail for reasons
other than the program ran out memory. There are specialized allocators tha=
t
only handle requests for specific sizes, such as pool allocators, that coul=
d
throw exceptions if they receive requests for sizes they cannot handle.</sp=
an></p>

<p class=3D"MsoNormal" style=3D"line-height:normal" zoompage-fontsize=3D"13=
"><span style=3D"font-size:12.0pt;font-family:&quot;Times New Roman&quot;,s=
erif" zoompage-fontsize=3D"16"><br></span></p><p class=3D"MsoNormal" style=
=3D"line-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:1=
2.0pt;font-family:&quot;Times New Roman&quot;,serif" zoompage-fontsize=3D"1=
6">This example shows how an allocator
might throw a bad_alloc exception with actionable information.</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><br></span></p=
><p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;li=
ne-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;=
font-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">void * PoolAl=
locator::Allocate(
std::size_t bytes, std::align_val_t alignment )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">{</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>if ( ( bytes &lt; mi=
nAllowedSize ) || (
maxAllowedSize &lt; bytes ) )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>{</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 </span>throw <b zoompage-fontsize=3D"13"><span style=3D"color:red=
" zoompage-fontsize=3D"13">SmartBadAllocException(</span></b></span></p>

<p class=3D"MsoNormal" style=3D"margin-top:0in;margin-right:0in;margin-bott=
om:0in;margin-left:1.0in;margin-bottom:.0001pt;text-indent:.5in;line-height=
:normal" zoompage-fontsize=3D"13"><b zoompage-fontsize=3D"13"><span style=
=3D"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:red" zoompag=
e-fontsize=3D"13">=E2=80=9CError! This allocator only handles allocations f=
rom 16 through 64
bytes in size.=E2=80=9D, __LINE__, __FUNCTION__ );</span></b></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>}</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>if ( !IsValidAlignme=
nt( alignment ) )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>{</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 </span>throw <b zoompage-fontsize=3D"13"><span style=3D"color:red=
" zoompage-fontsize=3D"13">SmartBadAllocException(</span></b></span></p>

<p class=3D"MsoNormal" style=3D"margin-top:0in;margin-right:0in;margin-bott=
om:0in;margin-left:1.0in;margin-bottom:.0001pt;text-indent:.5in;line-height=
:normal" zoompage-fontsize=3D"13"><b zoompage-fontsize=3D"13"><span style=
=3D"font-size:10.0pt;font-family:&quot;Courier New&quot;;color:red" zoompag=
e-fontsize=3D"13">=E2=80=9CError! This allocator only handles alignments on=
 4 byte
boundaries.=E2=80=9D, __LINE__, __FUNCTION__ );</span></b></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>}</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>void * place =3D Fin=
dPlace( bytes, alignment
);</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>if ( place =3D=3D nu=
llptr )</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>{</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0 </span>throw SmartBadAlloc( =E2=80=9CError! Unable
to allocate bytes.=E2=80=9D,</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>__LINE__, __FUNCTION__=
 );</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>}</span></p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13"><span zoompage=
-fontsize=3D"13">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 </span>return place;</span>=
</p>

<p class=3D"MsoNormal" style=3D"margin-bottom:0in;margin-bottom:.0001pt;lin=
e-height:normal" zoompage-fontsize=3D"13"><span style=3D"font-size:10.0pt;f=
ont-family:&quot;Courier New&quot;" zoompage-fontsize=3D"13">}</span></p></=
div></blockquote><div zoompage-fontsize=3D"13"><br></div><div zoompage-font=
size=3D"13">Unless you write an English language parser to figure out what =
those mean, the only &quot;actionable&quot; thing that can be done is by th=
e <i zoompage-fontsize=3D"13">programmer</i> (aka: spitting the message out=
 to the log), not by the program itself.</div><div zoompage-fontsize=3D"13"=
><br></div><div zoompage-fontsize=3D"13">The only way to make this detectab=
le by the program itself is to have it throw something other than (or more =
than) `bad_alloc`. None of which requires playing games with its string.<br=
></div><div zoompage-fontsize=3D"13">=C2=A0<br></div><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/42389eb4-97a9-4a1d-bbfb-c653ba62097f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/42389eb4-97a9-4a1d-bbfb-c653ba62097f=
%40isocpp.org</a>.<br />

------=_Part_3112_740863468.1504307057644--

------=_Part_3111_1365216330.1504307057642--

.


Author: Rich Sposato <rich.sposato@gmail.com>
Date: Fri, 1 Sep 2017 17:37:48 -0700 (PDT)
Raw View
------=_Part_3134_2045789438.1504312669039
Content-Type: multipart/alternative;
 boundary="----=_Part_3135_716419178.1504312669039"

------=_Part_3135_716419178.1504312669039
Content-Type: text/plain; charset="UTF-8"

Hi Everyone,

Thanks for your feedback and explaining why bad_alloc only has a default
constructor, unlike the other exception classes.

I can discard this proposal and implement one of the solutions suggested.

Cheers,

Rich

--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/69478cd1-a17f-4b15-8b16-2658d69cd48c%40isocpp.org.

------=_Part_3135_716419178.1504312669039
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Everyone,<br><br>Thanks for your feedback and explainin=
g why bad_alloc only has a default constructor, unlike the other exception =
classes.<br><br>I can discard this proposal and implement one of the soluti=
ons suggested.<br><br>Cheers,<br><br>Rich<br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/69478cd1-a17f-4b15-8b16-2658d69cd48c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/69478cd1-a17f-4b15-8b16-2658d69cd48c=
%40isocpp.org</a>.<br />

------=_Part_3135_716419178.1504312669039--

------=_Part_3134_2045789438.1504312669039--

.


Author: Bo Persson <bop@gmb.dk>
Date: Sat, 2 Sep 2017 12:15:08 +0200
Raw View
On 2017-09-02 01:04, Nicol Bolas wrote:
> On Friday, September 1, 2017 at 3:28:44 PM UTC-4, Rich Sposato wrote:

>=20
>     *5.**Allowing allocators to inform callers exactly why allocations
>     failed.*
>=20
>=20
>     Allocations may fail for reasons other than the program ran out
>     memory. There are specialized allocators that only handle requests
>     for specific sizes, such as pool allocators, that could throw
>     exceptions if they receive requests for sizes they cannot handle.
>=20
>=20
>     This example shows how an allocator might throw a bad_alloc
>     exception with actionable information.
>=20
>=20
>     void * PoolAllocator::Allocate( std::size_t bytes, std::align_val_t
>     alignment )
>=20
>     {
>=20
>     if ( ( bytes < minAllowedSize ) || ( maxAllowedSize < bytes ) )
>=20
>     {
>=20
>     throw *SmartBadAllocException(*
>=20
>     *=E2=80=9CError! This allocator only handles allocations from 16 thro=
ugh 64
>     bytes in size.=E2=80=9D, __LINE__, __FUNCTION__ );*
>=20
>     }
>=20
>     if ( !IsValidAlignment( alignment ) )
>=20
>     {
>=20
>     throw *SmartBadAllocException(*
>=20
>     *=E2=80=9CError! This allocator only handles alignments on 4 byte
>     boundaries.=E2=80=9D, __LINE__, __FUNCTION__ );*
>=20
>     }
>=20
>     void * place =3D FindPlace( bytes, alignment );
>=20
>     if ( place =3D=3D nullptr )
>=20
>     {
>=20
>     throw SmartBadAlloc( =E2=80=9CError! Unable to allocate bytes.=E2=80=
=9D,
>=20
>     __LINE__, __FUNCTION__ );
>=20
>     }
>=20
>     return place;
>=20
>     }
>=20
>=20
> Unless you write an English language parser to figure out what those=20
> mean, the only "actionable" thing that can be done is by the=20
> /programmer/ (aka: spitting the message out to the log), not by the=20
> program itself.
>=20
> The only way to make this detectable by the program itself is to have it=
=20
> throw something other than (or more than) `bad_alloc`. None of which=20
> requires playing games with its string.

Instead of parsing strings to identify a set of known reasons, we could=20
just as well have an enum failure_reason with those reasons specified.

An enum value is a lot easier to copy than a string.  :-)

And now we are very close the the feastures already available in the=20
header <system_error>.



--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/ooe0b6%24d99%241%40blaine.gmane.org.

.