C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::typeid_except ( Paper Attached )

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 6 Mar 2024 22:21:20 +0000
On Wed, Mar 6, 2024 at 8:32 PM Tom Honermann wrote:
>
> Review in LEWG will address all of these options.
>
> I think it would be helpful to update the design consideration section of your paper,
> or perhaps add a design alternatives section, that details some of the alternate design
> options and provides the rationale for your preferred solution.


I've added a new section entitled 'Alternatives' in which I discuss
the possibility of 'std::exception_ptr::type()':

    http://www.virjacode.com/papers/typeid_except.htm

Also it's attached to this email.

I know I said I wanted to keep this paper as simple as possible, but
I'm thinking it might make sense to squeeze in another function that
does something very similar:

    void *exception_object() noexcept;
    void *exception_object(exception_ptr const &p) noexcept;

This function gives you the address of the actual exception object.
The implementation would be identical for the vast majority (if not
all) compilers:

    void *exception_object(exception_ptr const &p) noexcept
    {
        return *(void**)addressof(p);
    }

   void *exception_object() noexcept
    {
        return exception_object( current_exception() );
    }

Believe it or not this even works on MS-Windows when you catch an SEH
exception inside a catch(...) block.

Received on 2024-03-06 22:21:33