<!doctype html>
<html lang="en">
  <head>
    <title>
                        April 2016
                : 
            Standard C++
    </title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="/favicon.ico" rel="shortcut icon">
    <link rel="apple-touch-icon" href="apple-touch-icon-57.png">
    <link rel="apple-touch-icon" sizes="72x72" href="apple-touch-icon-72.png">
    <link rel="apple-touch-icon" sizes="114x114" href="apple-touch-icon-114.png">
    <link rel="apple-touch-icon" sizes="144x144" href="apple-touch-icon-144.png">
    <link href="https://fonts.googleapis.com/css?family=Crimson+Text|Roboto|Roboto+Condensed:400,700&display=swap" rel="stylesheet">
    <link href="/assets/css/app.css?v012" rel="stylesheet" media="all" type="text/css">
    <link href="/assets/css/prettify.css" rel="stylesheet" media="all" type="text/css">

    <script type="text/javascript" src="/assets/js/prettify.min.js"></script>    
  </head>
  
  <body class="hide-sidebar">
    <div id="root">
    
      <div id="crown">
        <a id="sidebar-toggle" href="#sidebar">Show sidebar &raquo;</a>
        <ul class="user">
                          <li><a href="https://isocpp.org/member/login">Sign In / Suggest an Article</a></li>
          <li><a href="https://isocpp.org/member/register">Register</a></li>
                </ul>
      </div>

      <header id="top" role="banner">
        <div class="container">
          <h1>
            <a href="https://isocpp.org/"><img src="/assets/images/cpp_logo.png" alt="Standard C++"></a>
          </h1>
          <nav role="navigation">
            <ul id="nav-sub">
<li class="first"><a href="https://isocpp.org/get-started">Get Started!</a></li>
<li><a href="https://isocpp.org/tour">Tour</a></li>
<li><a href="https://isocpp.org/guidelines">Core Guidelines</a></li>
<li><a href="https://isocpp.org/faq">Super-FAQ</a></li>
<li><a href="https://isocpp.org/std">Standardization</a></li>
<li class="last"><a href="https://isocpp.org/about">About</a></li>
</ul>
          </nav>
          <form action="/search/google">
            <input type="text" name="q" id="q" maxlength="100" value="" class="textbox">
            <input type="submit" value="Search" class="button">
          </form>
          <!--
          <form method="post" action="https://isocpp.org/"  >
<div class='hiddenFields'>
<input type="hidden" name="ACT" value="6" />
<input type="hidden" name="XID" value="e7620d9e8d9cb133c824a9094f633d419c484f52" />
<input type="hidden" name="RES" value="" />
<input type="hidden" name="meta" value="YTo5OntzOjY6InN0YXR1cyI7czowOiIiO3M6NzoiY2hhbm5lbCI7czoxOToiYmxvZ3xwYWdlc3xmYXF8d2lraSI7czo4OiJjYXRlZ29yeSI7czowOiIiO3M6OToic2VhcmNoX2luIjtzOjEwOiJldmVyeXdoZXJlIjtzOjU6IndoZXJlIjtzOjM6ImFsbCI7czoxMjoic2hvd19leHBpcmVkIjtzOjA6IiI7czoxOToic2hvd19mdXR1cmVfZW50cmllcyI7YjowO3M6MTE6InJlc3VsdF9wYWdlIjtzOjE0OiJzZWFyY2gvcmVzdWx0cyI7czoxNToibm9fcmVzdWx0c19wYWdlIjtzOjE3OiJzZWFyY2gvbm9fcmVzdWx0cyI7fTNkZmE5MTM0YzRkODdjNWE2MDc5Y2YxZjA5OGYxOTRh" />
<input type="hidden" name="site_id" value="1" />
</div>


            <input type="text" name="keywords" id="keywords" maxlength="100" value="M50o93H7pQ09L8X1t49cHY01Z5j4TT91fGfr" class="textbox">
            <input type="submit" value="Search" class="button">
          </form>
          -->
        </div>
      </header>

      <div id="content" class="hide-sidebar" role="main">
        <div class="container">


<div id="sidebar">
        <section>
              <header>Features</header>
            <div class="sidebar-section-content prettify">
        <p>
	<a href="https://isocpp.org/std/status">Current ISO C++ status</a></p>
<p>
	&nbsp;</p>
<p>
	<a href="https://isocpp.org/std/standing-documents">ISO C++ standing documents</a></p>
<p>
	&nbsp;</p>
<p>
	<a href="https://isocpp.org/std/meetings-and-participation/upcoming-meetings">Upcoming ISO C++ meetings</a></p>
<p>
	&nbsp;</p>
<p>
	<a href="https://isocpp.org/wiki/faq/conferences-worldwide">Upcoming C++ conferences</a></p>
<p>
	&nbsp;</p>
<p>
	<a href="http://en.cppreference.com/w/cpp/compiler_support">Compiler conformance status</a></p>
      </div>
    </section>
  
  
  <nav>
    <section>
      <header>
        Categories
      </header>
      <ul>
      <ul id="nav_categories" class="nav_categories">
			<li>
        <li><a href="https://isocpp.org/blog/category/news">News</a></li>
      </li>
			<li>
        <li><a href="https://isocpp.org/blog/category/product-news">Product News</a></li>
      </li>
			<li>
        <li><a href="https://isocpp.org/blog/category/articles-books">Articles & Books</a></li>
      </li>
			<li>
        <li><a href="https://isocpp.org/blog/category/video-on-demand">Video & On-Demand</a></li>
      </li>
			<li>
        <li><a href="https://isocpp.org/blog/category/events">Events</a></li>
      </li>
			<li>
        <li><a href="https://isocpp.org/blog/category/training">Training</a></li>
      </li>
			<li>
        <li><a href="https://isocpp.org/blog/category/standardization">Standardization</a></li>
      </li>
		</ul>

      </ul>
    </section>
    
    <section>
      <header>Tags</header>
      <p class="tags">
      
        <a href="/blog/tag/basics">basics</a>
      
        <a href="/blog/tag/intermediate">intermediate</a>
      
        <a href="/blog/tag/advanced">advanced</a>
      
        <a href="/blog/tag/experimental">experimental</a>
      
      </p>
    </section>
    
    <section>
      <header>
        Subscribe
      </header>
      <div>
        <ul>
          <li><a href="https://isocpp.org/blog/rss" class="icon rss">All Posts</a></li>
          <li><a href="https://isocpp.org/blog/rss_comments" class="icon rss">All Comments</a></li>
          
            <li><a href="https://isocpp.org/blog/rss/category/news" class="icon rss">News</a></li>
          
            <li><a href="https://isocpp.org/blog/rss/category/product-news" class="icon rss">Product News</a></li>
          
            <li><a href="https://isocpp.org/blog/rss/category/articles-books" class="icon rss">Articles & Books</a></li>
          
            <li><a href="https://isocpp.org/blog/rss/category/video-on-demand" class="icon rss">Video & On-Demand</a></li>
          
            <li><a href="https://isocpp.org/blog/rss/category/events" class="icon rss">Events</a></li>
          
            <li><a href="https://isocpp.org/blog/rss/category/training" class="icon rss">Training</a></li>
          
            <li><a href="https://isocpp.org/blog/rss/category/standardization" class="icon rss">Standardization</a></li>
          
        </ul>
      </div>
    </section>

    <section>
      <header>
        Archives
      </header>
      <ul>
        <li><a href="https://isocpp.org/blog/2025/09">September 2025</a></li>
<li><a href="https://isocpp.org/blog/2025/08">August 2025</a></li>
<li><a href="https://isocpp.org/blog/2025/07">July 2025</a></li>
<li><a href="https://isocpp.org/blog/2025/06">June 2025</a></li>
<li><a href="https://isocpp.org/blog/2025/05">May 2025</a></li>
<li><a href="https://isocpp.org/blog/2025/04">April 2025</a></li>
<li><a href="https://isocpp.org/blog/2025/03">March 2025</a></li>
<li><a href="https://isocpp.org/blog/2025/02">February 2025</a></li>
<li><a href="https://isocpp.org/blog/2025/01">January 2025</a></li>
<li><a href="https://isocpp.org/blog/2024/12">December 2024</a></li>
<li><a href="https://isocpp.org/blog/2024/11">November 2024</a></li>
<li><a href="https://isocpp.org/blog/2024/10">October 2024</a></li>

      </ul>
    </section>
  </nav>
    
      <section>
              <header>Upcoming Events</header>
            <div class="sidebar-section-content">
        <p>
	<strong><a href="http://italiancpp.github.io/cppday25">C++ Day 2025</a></strong></p>
<p>
	October 25, Pavia, Italy</p>
<p>
	&nbsp;</p>
<p>
	<a href="https://meetingcpp.com/2025/"><strong>Meeting C++ 2025</strong></a></p>
<p>
	November 6-8, Berlin, Germany</p>
<p>
	&nbsp;</p>
<p>
	<a href="https://isocpp.org/files/papers/N4977.pdf"><strong>ISO C++ standards meeting</strong></a></p>
<p>
	November 3-8, Kona, HI, USA</p>
      </div>
    </section>
  
</div>

<div id="mainbar">

    <header>
    <div class="breadcrumbs">
      <a href="/">Home</a> &raquo; 
              <a href="/blog">Blog</a> &raquo; <a href="/blog/2016">2016</a> &raquo; 
        April          </div>
    
          
        
      
        
      
                      <div class="pagination">
                                <a class="next" href="https://isocpp.org/blog/2016/04/p3141/P34">&laquo; Prev</a>
                                              <a class="next" href="">Next &raquo;</a>
                          </div>
                  
    
    <h2>
          April 2016
        </h2>
  </header>
  
      
    
      <article class="prettify">
        <h3 class="flush-bottom"><a href="https://isocpp.org/blog/2016/04/p3141">P3141: std::terminates()</a></h3>
        <p class="byline">By Blog Staff | 
        Apr 1, 2016 01:00 AM 
         | 
        Tags: <em>None</em>  </p>
        <p>
	A new WG21 paper is available.</p>
<blockquote>
	<p>
		Document number: P3141</p>
	<p>
		Date: 2016-04-01</p>
	<h2>
		std::terminates()</h2>
	<p>
		by Hal T. Ng, Professor, C.S., LLVM.edu</p>
</blockquote>
<p>
	Excerpt:</p>
<blockquote>
	<p>
		In 2014, the C++ committee tackled the problem of C++98&#39;s subtly hard-to-use&nbsp;<code>std::uncaught_exception()</code>, which was intended to return whether there were unhandled exceptions but did not work as intended in all destructor cases. The committee successfully addressed the problem by providing the&nbsp;improved&nbsp;<code>std::uncaught_exceptions()</code>&nbsp;(note plural "s"), which returns the number of unhandled exceptions in the current thread, and this function can now be used to reliably implement <code>scope_guard</code> and similar patterns in portable code.</p>
	<p>
		Continuing in the same vein, this paper proposes to address C++98&#39;s related and sometimes-problematic <code>std::terminate()</code>. As its name suggests, the function causes abrupt program halts, which can cause data corruption if operations in flight are not completed gracefully. The <code>set_terminate_handler()</code> facility only partly addresses this problem by allowing a last-ditch handler to be invoked after unstoppable termination has already begun.</p>
	<p>
		Along the same lines as conditional <code>noexcept</code> (<code>noexcept(cond)</code>), we propose a way for a sensitive operation, or a whole program, to determine in advance whether termination is possible. A program can test this by calling:</p>
	<pre class="prettyprint lang-cpp">
namespace std {&#10;    bool terminates();&#10;}&#10;</pre>
	<p>
		which returns <code>true</code> if and only if the program can subsequently terminate.</p>
	<p>
		<span style="line-height: 1;">Because this function cannot fail to determine a valid result, it should be </span><code style="line-height: 1;">noexcept</code><span style="line-height: 1;">. Further, anticipating its usefulness in constant expressions and following LWG&rsquo;s guidance for using <code>constexpr</code> wherever possible throughout the standard library, we propose in full:</span></p>
	<pre class="prettyprint lang-cpp">
namespace std {&#10;    constexpr bool terminates() noexcept;&#10;} </pre>
	<p>
		Implementation notes: This function is so simple to specify that we foresee no implementation difficulty in any of the major C++ compilers.</p>
	<p>
		Note that this is not the same as the halting problem, which would be to return <code>true</code> if and only if the program <em>will</em> halt, and which is known to take several hours to compute for programs longer than a few tens of millions of lines. Rather, this function is carefully constructed to return <code>true</code> if and only if the program <em>could</em> terminate, which is fundamentally different and well understood problem.</p>
	<p>
		<em>Acknowledgments:</em> This paper expands on the core idea that was first proposed in committee hallway discussion by P.J. Plauger.</p>
</blockquote>
      </article>

      
      
    
    
      <article class="prettify">
        <h3 class="flush-bottom"><a href="https://isocpp.org/blog/2016/04/lifetime-safety-checker">C++ Core Guidelines Checkers: Preview of the Lifetime Safety checker--Andrew Pardoe</a></h3>
        <p class="byline">By Marco Arena | 
        Apr 1, 2016 12:40 AM 
         | 
        Tags: 
                    <a href="https://isocpp.org/blog/tag/visual+studio" class="tag">visual studio</a></p>
        <p>
	The Visual C++ Team announces&nbsp;a preview of the <strong>Lifetime Safety checker&nbsp;</strong>for <a href="https://blogs.msdn.microsoft.com/vcblog/2015/12/03/c-core-guidelines-checkers-available-for-vs-2015-update-1/">CppCoreCheck</a>:</p>
<blockquote>
	<h4>
		<a href="https://blogs.msdn.microsoft.com/vcblog/2016/03/31/c-core-guidelines-checkers-preview-of-the-lifetime-safety-checker/">C++ Core Guidelines Checkers: Preview of the Lifetime Safety checker</a></h4>
</blockquote>
<p>
	From the article:</p>
<blockquote>
	<p style="text-align: justify;">
		Lifetime safety is ensuring that the lifetime of any object matches its use.&nbsp;That is, don&rsquo;t leak objects by forgetting to delete them in the case that they were allocated on the heap, and don&rsquo;t access objects...</p>
</blockquote>
      </article>

      
      
    
    
      <article class="prettify">
        <h3 class="flush-bottom"><a href="https://isocpp.org/blog/2016/03/cpp-sessions-at-jax-finance">C++ sessions at JAX Finance</a></h3>
        <p class="byline">By Roger Orr | 
        Mar 31, 2016 11:44 PM 
         | 
        Tags: <em>None</em>  </p>
        <p>
	The JAX Finance conference is to be held in London in April.</p>
<blockquote>
	<h3>
		<a href="https://finance.jaxlondon.com/">The Conference for Technology in Finance</a></h3>
</blockquote>
<p>
	About the conference:</p>
<blockquote>
	<p>
		<span style="line-height: 1;">JAX Finance is a three-day conference for software experts focusing on the specific technological needs of the financial industry.</span></p>
	<p>
		<span style="line-height: 1;">This year the conference includes a number of sessions on C++ (in addition to the existing focus on Java.)</span></p>
	<p>
		<span style="line-height: 1;">Dates: 27 - 29 Apr</span></p>
	<p>
		<span style="line-height: 1;">Venue: Park Plaza Victoria, London</span></p>
</blockquote>
<p>
	&nbsp;</p>
      </article>

      
      
    
    
  <footer>
  
          
        
      
        
      
                      <div class="pagination">
                                <a class="next" href="https://isocpp.org/blog/2016/04/p3141/P34">&laquo; Prev</a>
                                              <a class="next" href="">Next &raquo;</a>
                          </div>
                  
        
    <div class="back-to-top">
      <a href="#">Back to Top</a>
    </div>
  </footer>

</div>

        </div>
        
        <div id="root-footer"></div>
      </div>
    </div>

    <footer id="bottom" role="contentinfo">
      <div class="container">
        &copy; <a href="/home/terms-of-use">Copyright</a> 2025 Standard C++ Foundation. 
        All rights reserved.
        <ul id="nav-sub">
<li class="first"><a href="https://isocpp.org/home/terms-of-use">Terms of Use</a></li>
<li class="last"><a href="https://isocpp.org/home/privacy-policy">Privacy Policy</a></li>
</ul>
        <br>Hosted by <a href="https://m.do.co/c/32f291566cf7" target="_blank">DigitalOcean</a>
        
      </div>
    </footer>

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="https://isocpp.org/javascript/jquery.min"><\/script>')</script>
    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js"></script>
    <script>window.jQuery.ui || document.write('<script src="https://isocpp.org/javascript/jquery-ui.min"><\/script>')</script>
    
    <script type="text/javascript" charset="utf-8" src="https://isocpp.org/?ACT=comment_editor"></script>
    <script type="text/javascript">
	        					$(document).ready(function() {
									$("*[id^=likee_]").click(function(){
										var ids = $(this).attr("id").split("_");
										if (ids[1]=="c"){
											id=ids[2];
											c="c_";
											isCom="true";
										} else {
											id=ids[1];
											c="";
											isCom="false";
										}
										
										$.ajax({
	   										type: "POST",
	   										url: "/blog/2016/04/p3141/P44",
	   										data: "likee=true&entry_id="+id+"&isCom="+isCom,
	   										success: function(msg){
	     										//alert( "Data Saved: " + msg );
	   										}
	 									});
	 									
	 									$(this).replaceWith("<strong>"+$(this).html()+"</strong>");
	 									$("#dislikee_"+c+id).replaceWith("<span>"+$("#dislikee_"+c+id).html()+"</span>");
	 									$("#scoreeCount_"+c+id).html(parseInt($("#scoreeCount_"+c+id).html())+1);
	 									$("#likeeCount_"+c+id).html(parseInt($("#likeeCount_"+c+id).html())+1);
	 									$("#likeeReplace_"+c+id).replaceWith("");
	 									$("#likeeShow_"+c+id).replaceWith($("#likeeShow_"+c+id).html());
									});
									
									$("*[id^=dislikee_]").click(function(){
										var ids = $(this).attr("id").split("_");
										if (ids[1]=="c"){
											id=ids[2];
											c="c_";
											isCom="true";
										} else {
											id=ids[1];
											c="";
											isCom="false";
										}
										$.ajax({
	   										type: "POST",
	   										url: "/blog/2016/04/p3141/P44",
	   										data: "dislikee=true&entry_id="+id+"&isCom="+isCom,
	   										success: function(msg){
	     										//alert( "Data Saved: " + msg );
	   										}
	 									});
	 									
	 									$(this).replaceWith("<strong>"+$(this).html()+"</strong>");
	 									$("#likee_"+c+id).replaceWith("<span>"+$("#likee_"+c+id).html()+"</span>");
	 									$("#scoreeCount_"+c+id).html(parseInt($("#scoreeCount_"+c+id).html())-1);
	 									$("#dislikeeCount_"+c+id).html(parseInt($("#dislikeeCount_"+c+id).html())+1);
	 									$("#likeeReplace_"+c+id).replaceWith("");
	 									$("#likeeShow_"+c+id).replaceWith($("#likeeShow_"+c+id).html());
									});
								
								});	
	        			  </script>
    
    <script type="text/javascript" src="/js/isocpp.lib.min.js"></script>
    <script type="text/javascript" src="/js/global.js"></script>

        
    <script type="text/javascript">
      $("#top nav a").each(function() {
        var aSeg1 = $(this).attr("href").replace("http://", "").replace("https://", "").split("/")[1];
        if (aSeg1 == "blog") {$(this).parent().addClass("here");}
      });
    </script>

  </body>
</html>