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


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

Re: need argument for try catch blocks

From Edek <edek.pieITAKNIECZYTAM@gmail.com>
Newsgroups comp.lang.c++
Subject Re: need argument for try catch blocks
Date 2011-05-27 14:48 +0200
Organization ATMAN - ATM S.A.
Message-ID <iro694$vgm$1@node2.news.atman.pl> (permalink)
References <b5983f42-b483-48da-bd66-21d4cecd88b1@v31g2000vbs.googlegroups.com> <iro3o6$t1o$1@node2.news.atman.pl> <iro4ma$f08$1@news.ett.com.ua>

Show all headers | View raw


On 05/27/2011 02:16 PM, Balog Pal wrote:
>
> "Edek" <edek.pieITAKNIECZYTAM@gmail.com>
>> If they do anything that is necessary or of value, they should be
>> there. Naturally, the project formal/informal policy is one thing to
>> follow, but in general such 'extra' try-catches are done for example:
>>
>> a) to clean up resources (like DB, if destructors are not enough),
>> then they are necessary
>
> Hell no. Resources must be handler by RAII, and never left to hang
> around "raw". And mandatory release code must not be multiplicated at
> every possible exit.

Is it possible to do anything which may throw during stack unwind? I 
always thought that was UB.

>
>> c) to log, if there are no stack traces and for some reason a debugger
>> cannot be used, or just it is quicker to have a log without plugging
>> in a debugger
>
> Logging is a suspicious reason, and if really needed also can be done
> better in a RAII-like form. Though special cases may apply.

Like having no exception stack trace? Hell, I like getting at the top of 
the thread an information along the lines of 'Integer conversion failed' 
and nothing more.

>
>> d) to work around caller code, which does not really handle
>> exceptions, or handles just a few types - then catching is better than
>> terminate()
>
> I'd rather call it "when exceptions must be converted to error return
> codes for the caller".
>

Sure.

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


Thread

need argument for try catch blocks Christopher <cpisz@austin.rr.com> - 2011-05-26 08:20 -0700
  Re: need argument for try catch blocks "Balog Pal" <pasa@lib.hu> - 2011-05-26 18:24 +0200
    Re: need argument for try catch blocks Christopher <cpisz@austin.rr.com> - 2011-05-26 10:28 -0700
      Re: need argument for try catch blocks Christopher <cpisz@austin.rr.com> - 2011-05-26 10:31 -0700
      Re: need argument for try catch blocks "Balog Pal" <pasa@lib.hu> - 2011-05-26 20:36 +0200
        Re: need argument for try catch blocks Keith H Duggar <duggar@alum.mit.edu> - 2011-05-27 06:10 -0700
          Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-06 04:24 -0500
        Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-06 05:22 -0500
          Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-06-06 21:53 -0700
            Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-06-06 23:48 -0700
              Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-06-07 00:18 -0700
            Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-07 07:13 -0500
              Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-06-07 07:33 -0700
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-07 10:08 -0500
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-07 10:12 -0500
                Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-06-07 13:59 -0700
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-07 16:48 -0500
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-07 18:20 -0500
                Re: need argument for try catch blocks Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-07 14:42 -0700
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-07 18:13 -0500
                Re: need argument for try catch blocks Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-07 16:21 -0700
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-07 19:13 -0500
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-08 07:07 -0500
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-08 07:12 -0500
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-09 07:19 -0500
                Re: need argument for try catch blocks "io_x" <a@b.c.invalid> - 2011-06-09 21:00 +0200
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-08 15:40 -0500
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-08 16:07 -0500
                Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-09 10:21 -0500
  Re: need argument for try catch blocks Juha Nieminen <nospam@thanks.invalid> - 2011-05-27 06:40 +0000
  Re: need argument for try catch blocks Edek <edek.pieITAKNIECZYTAM@gmail.com> - 2011-05-27 14:05 +0200
    Re: need argument for try catch blocks "Balog Pal" <pasa@lib.hu> - 2011-05-27 14:16 +0200
      Re: need argument for try catch blocks Edek <edek.pieITAKNIECZYTAM@gmail.com> - 2011-05-27 14:48 +0200
        Re: need argument for try catch blocks "Balog Pal" <pasa@lib.hu> - 2011-05-27 15:10 +0200
          Re: need argument for try catch blocks Edek <edek.pieITAKNIECZYTAM@gmail.com> - 2011-05-27 15:54 +0200
            Re: need argument for try catch blocks "Balog Pal" <pasa@lib.hu> - 2011-05-27 16:13 +0200
          Re: need argument for try catch blocks "Fred Zwarts" <F.Zwarts@KVI.nl> - 2011-05-30 09:56 +0200
            Re: need argument for try catch blocks "Balog Pal" <pasa@lib.hu> - 2011-05-30 10:22 +0200
      Re: need argument for try catch blocks Christopher <cpisz@austin.rr.com> - 2011-05-27 07:43 -0700
        Re: need argument for try catch blocks Paavo Helde <myfirstname@osa.pri.ee> - 2011-05-27 10:19 -0500
        Re: need argument for try catch blocks "Balog Pal" <pasa@lib.hu> - 2011-05-27 17:58 +0200
          Re: need argument for try catch blocks Keith H Duggar <duggar@alum.mit.edu> - 2011-05-30 09:43 -0700
            Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-05-30 11:58 -0700
            Re: need argument for try catch blocks Christopher <cpisz@austin.rr.com> - 2011-05-31 08:57 -0700
              Re: need argument for try catch blocks Keith H Duggar <duggar@alum.mit.edu> - 2011-05-31 13:33 -0700
                Re: need argument for try catch blocks Ian Collins <ian-news@hotmail.com> - 2011-06-01 09:03 +1200
                Re: need argument for try catch blocks Keith H Duggar <duggar@alum.mit.edu> - 2011-05-31 14:57 -0700
                Re: need argument for try catch blocks "Balog Pal" <pasa@lib.hu> - 2011-06-01 02:06 +0200
                Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-05-31 16:32 -0700
                Re: need argument for try catch blocks Christopher <cpisz@austin.rr.com> - 2011-06-01 11:42 -0700
                Re: need argument for try catch blocks Keith H Duggar <duggar@alum.mit.edu> - 2011-06-02 16:01 -0700
                Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-06-03 04:27 -0700
                Re: need argument for try catch blocks Christopher <cpisz@austin.rr.com> - 2011-06-03 07:39 -0700
                Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-06-03 10:43 -0700
                Re: need argument for try catch blocks Keith H Duggar <duggar@alum.mit.edu> - 2011-06-03 11:31 -0700
                Re: need argument for try catch blocks Christopher <cpisz@austin.rr.com> - 2011-06-03 12:14 -0700
                Re: need argument for try catch blocks Leigh Johnston <leigh@i42.co.uk> - 2011-06-03 21:22 +0100
                Re: need argument for try catch blocks "Balog Pal" <pasa@lib.hu> - 2011-06-04 17:30 +0200
                Re: need argument for try catch blocks Keith H Duggar <duggar@alum.mit.edu> - 2011-06-04 15:16 -0700
                Re: need argument for try catch blocks Jorgen Grahn <grahn+nntp@snipabacken.se> - 2011-06-11 10:22 +0000
                Re: need argument for try catch blocks Edek <edek.pienkowski@gmail.com> - 2011-06-03 21:17 +0200
                Re: need argument for try catch blocks Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-03 18:24 -0700
                Re: need argument for try catch blocks Edek <edek.pienkowski@gmail.com> - 2011-06-04 19:34 +0200
                Re: need argument for try catch blocks Joshua Maurice <joshuamaurice@gmail.com> - 2011-06-04 19:39 -0700
                Re: need argument for try catch blocks Keith H Duggar <duggar@alum.mit.edu> - 2011-06-04 07:22 -0700
                Re: need argument for try catch blocks Edek <edek.pienkowski@gmail.com> - 2011-06-04 19:24 +0200
                Re: need argument for try catch blocks Christopher <cpisz@austin.rr.com> - 2011-06-03 07:51 -0700
                Re: need argument for try catch blocks "Alf P. Steinbach /Usenet" <alf.p.steinbach+usenet@gmail.com> - 2011-06-03 20:57 +0200
                Re: need argument for try catch blocks Dombo <dombo@disposable.invalid> - 2011-06-05 13:29 +0200
        Re: need argument for try catch blocks Edek <edek.pieITAKNIECZYTAM@gmail.com> - 2011-05-27 19:01 +0200
          Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-05-31 17:13 -0700
            Re: need argument for try catch blocks Edek <edek.pienkowski@gmail.com> - 2011-06-03 16:04 +0200
              Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-06-03 09:44 -0700
                Re: need argument for try catch blocks Edek <edek.pienkowski@gmail.com> - 2011-06-03 19:04 +0200
                Re: need argument for try catch blocks Öö Tiib <ootiib@hot.ee> - 2011-06-04 07:05 -0700
      Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-06 05:15 -0500
  Re: need argument for try catch blocks "MikeP" <mp011011@some.org> - 2011-06-06 04:43 -0500

csiph-web