<br>On Wednesday, March 6, 2024, Tom Honermann wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><u></u>

  
    
  
  <div>
    <div>On 3/6/24 3:07 AM, Frederick Virchanza
      Gotham wrote:</div>
    <p>For the form that returns a <font face="monospace">std::type_info</font>
      reference for the currently handled exception, I prefer <font face="monospace">current_exception_typeid()</font> for
      consistency with <font face="monospace">current_exception()</font>
      and the <font face="monospace">typeid</font> operator (assuming
      this form is needed at all).<br>
    </p></div></blockquote><div><br></div><div><br></div><div>I don&#39;t agree with you here however it would be a small compromise to make, if more people would prefer &#39;current_exception_typeid&#39;. I&#39;m not gonna get caught up on what English words we use -- so long as we can use the feature.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>
    <p>For the form that returns a <font face="monospace">std::type_info</font>
      reference from a <font face="monospace">std::exception_ptr</font>
      <i>E</i>, I prefer the addition of a <font face="monospace">type_info()</font>
      member function to enable <font face="monospace"><i>E</i>.type_info()</font>
      assuming that this is implementable on all platforms without an
      ABI break (<a href="http://eel.is/c++draft/propagation#6" target="_blank">[propagation]p6</a>
      contains a note that states &quot;An implementation can use a
      reference-counted smart pointer as <font face="monospace">exception_ptr</font>&quot;
      which suggests to me that a generic smart pointer can be used
      subject to the implicit conversion limitations).</p></div></blockquote><div><br></div><div><br></div><div>Yeah I think it might be an idea to add a few non-static non-virtual methods to &#39;exception_ptr&#39;, such as to get the &#39;type_info&#39;, or to get a pointer to the bytes of the exception object.</div><div><br></div><div>For the time being though, I want to keep this proposal very simple. It won&#39;t be the end of the world if we end up with a little redundancy in C++29 whereby we have a choice of using either &#39;std::typeid_except&#39; or &#39;std::exception_ptr::type&#39;.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><p>If that isn&#39;t an
      option for some implementations, then I prefer <font face="monospace">get_exception_type_info()</font> for
      consistency with <font face="monospace">rethrow_exception()</font>.<br>
    </p>
    <p>If the latter form is provided, then I don&#39;t see a need for the
      former form. I don&#39;t see compelling motivation to be able to query
      the type in the forced unwinding scenario in which <font face="monospace">current_exception()</font> returns a null <font face="monospace">std::exception_ptr</font>.</p></div></blockquote><div><br></div><div><br></div><div>I want to be comprehensive here and cover all bases. The last thing I want is to receive an email in 2031 from some guy writing a compiler for an Arduino microcontroller asking me why I didn&#39;t push harder for the parameterless version. But even today in 2024, we have scenarios where &#39;current_exception()&#39; returns a nullptr even though there is &#39;type_info&#39; available. If a person is logging every exception that is thrown, i.e. logging the &#39;type_info&#39; and also possibly the &#39;what()&#39; of what was thrown, then maybe they also want to log forced unwinds too, and to have something descriptive like &quot;abi::__forced_unwind&quot; instead of just &#39;typeid(void)&#39;.</div><div><br></div><div>I think we really should have a parameterless version of the function. Personally I would give both functions the same name, but if others want to give them different names then I&#39;m easy.</div>

