Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #89571

Re: Why no structured bings in catch()?

From Paavo Helde <eesnimi@osa.pri.ee>
Newsgroups comp.lang.c++
Subject Re: Why no structured bings in catch()?
Date 2023-03-09 14:06 +0200
Organization A noiseless patient Spider
Message-ID <tuci48$1ebq4$1@dont-email.me> (permalink)
References (2 earlier) <tu9sgq$t404$1@dont-email.me> <cone.1678277585.903048.160444.1004@monster.email-scan.com> <tuacml$vrgq$1@dont-email.me> <cone.1678322351.933124.195471.1004@monster.email-scan.com> <tuc7th$1cl8k$1@dont-email.me>

Show all headers | View raw


09.03.2023 11:12 Muttley@dastardlyhq.com kirjutas:

> 
> Once something is thrown the runtime knows what it is and simply has to
> match it with a catch as it does now. I'm not pretending matching an auto
> would be simple but I don't see why it should be impossible. After all, the
> runtime has to differentiate between int, char, parent and child classes to
> do proper catching.

Yes, and it generates code for handling them at compile time, for the 
types which are explicitly specified in the catch clause.

If one wants to support catch handlers which catch any "templated" type, 
one would need to generate catch handler code for all types present in 
the program. This would need at least link-time code generation and 
could easily produce catch handler code many times larger than the rest 
of the program.

If the program uses dynamic libraries, link-time code generation would 
not be sufficient. One would need to generate code at run time. This is 
not something what is commonly done in C++. And what happens if it 
appears the "template" cannot be instantiated for these new types? You 
would get a compile error at run time. Ugh... that would not be C++ any 
more.


Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Why no structured bings in catch()? Muttley@dastardlyhq.com - 2023-03-08 10:04 +0000
  Re: Why no structured bings in catch()? Öö Tiib <ootiib@hot.ee> - 2023-03-08 03:23 -0800
    Re: Why no structured bings in catch()? Muttley@dastardlyhq.com - 2023-03-08 11:45 +0000
      Re: Why no structured bings in catch()? Sam <sam@email-scan.com> - 2023-03-08 07:13 -0500
        Re: Why no structured bings in catch()? Muttley@dastardlyhq.com - 2023-03-08 16:21 +0000
          Re: Why no structured bings in catch()? Bo Persson <bo@bo-persson.se> - 2023-03-08 19:21 +0100
          Re: Why no structured bings in catch()? Sam <sam@email-scan.com> - 2023-03-08 19:39 -0500
            Re: Why no structured bings in catch()? Muttley@dastardlyhq.com - 2023-03-09 09:12 +0000
              Re: Why no structured bings in catch()? Bonita Montero <Bonita.Montero@gmail.com> - 2023-03-09 10:16 +0100
              Re: Why no structured bings in catch()? Paavo Helde <eesnimi@osa.pri.ee> - 2023-03-09 14:06 +0200
              Re: Why no structured bings in catch()? Sam <sam@email-scan.com> - 2023-03-10 06:58 -0500
      Re: Why no structured bings in catch()? Andrey Tarasevich <andreytarasevich@hotmail.com> - 2023-03-08 14:55 -0800
  Re: Why no structured bings in catch()? Bonita Montero <Bonita.Montero@gmail.com> - 2023-03-08 18:28 +0100
    Re: Why no structured bings in catch()? Muttley@dastardlyhq.com - 2023-03-09 09:13 +0000
      Re: Why no structured bings in catch()? Öö Tiib <ootiib@hot.ee> - 2023-03-09 03:18 -0800
      Re: Why no structured bings in catch()? Bonita Montero <Bonita.Montero@gmail.com> - 2023-03-09 17:06 +0100
      Re: Why no structured bings in catch()? Christian Gollwitzer <auriocus@gmx.de> - 2023-03-10 08:12 +0100
        Re: Why no structured bings in catch()? Muttley@dastardlyhq.com - 2023-03-10 10:05 +0000
          Re: Why no structured bings in catch()? Öö Tiib <ootiib@hot.ee> - 2023-03-10 05:04 -0800
            Re: Why no structured bings in catch()? Muttley@dastardlyhq.com - 2023-03-10 16:14 +0000
  Re: Why no structured bings in catch()? Daniel <danielaparker@gmail.com> - 2023-03-09 11:38 -0800
    Re: Why no structured bings in catch()? Muttley@dastardlyhq.com - 2023-03-10 10:03 +0000

csiph-web