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


Groups > comp.lang.c > #29062

Re: Exceptions handling in C + assembler

From James Kuyper <jameskuyper@verizon.net>
Newsgroups comp.lang.c
Subject Re: Exceptions handling in C + assembler
Date 2012-12-08 09:35 -0500
Organization A noiseless patient Spider
Message-ID <k9vj7d$fu2$1@dont-email.me> (permalink)
References (2 earlier) <k9t2lc$c83$1@node1.news.atman.pl> <50C21829.9090705@verizon.net> <k9t7ff$h2c$1@node1.news.atman.pl> <71d8f792-698f-4740-9841-4a587eb00f91@u19g2000yqj.googlegroups.com> <9FGws.826493$EF4.183573@fx23.am4>

Show all headers | View raw


On 12/08/2012 07:46 AM, BartC wrote:
> 
> 
> "christian.bau" <christian.bau@cbau.wanadoo.co.uk> wrote in message 
> news:71d8f792-698f-4740-9841-4a587eb00f91@u19g2000yqj.googlegroups.com...
...
>> When an exception is thrown, you have to clean up resources as the
>> exception winds its way through the call chain.
> 
> What sort of resources need to be cleaned up?

The resources, if any, associated with objects with automatic storage
duration whose lifetime is ended by the throwing of the exception, or
which are released in catch{} blocks that match the thrown exception.

> Local objects that would have been deallocated on a normal return are 
> understood. But what about more global/more persistent changes, where it's 
> not clear what the intentions of the intermediate function would have been?

The "intentions" of the intermediate function are, in C++, expressed in
two ways: the destructors of the objects that are local to that
function, and the code in the catch{} blocks that correspond to the
thrown exception. It's more than a little difficult to do that in C,
which has neither destructors nor catch{} blocks.
-- 
James Kuyper

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


Thread

Exceptions handling in pure C "Borneq" <borneq@antyspam.hidden.pl> - 2012-12-07 07:50 +0100
  Re: Exceptions handling in pure C Ian Collins <ian-news@hotmail.com> - 2012-12-07 20:42 +1300
    Re: Exceptions handling in pure C "Borneq" <borneq@antyspam.hidden.pl> - 2012-12-07 09:23 +0100
      Re: Exceptions handling in pure C Ian Collins <ian-news@hotmail.com> - 2012-12-07 21:41 +1300
        Re: Exceptions handling in pure C BGB <cr88192@hotmail.com> - 2012-12-07 03:10 -0600
          Re: Exceptions handling in pure C Ian Collins <ian-news@hotmail.com> - 2012-12-08 07:44 +1300
            Re: Exceptions handling in pure C BGB <cr88192@hotmail.com> - 2012-12-07 17:26 -0600
        Re: Exceptions handling in pure C "Borneq" <borneq@antyspam.hidden.pl> - 2012-12-08 11:08 +0100
          Re: Exceptions handling in pure C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-12-08 19:02 +0000
            Re: Exceptions handling in pure C Jorgen Grahn <grahn+nntp@snipabacken.se> - 2012-12-08 19:22 +0000
  Re: Exceptions handling in pure C James Kuyper <jameskuyper@verizon.net> - 2012-12-07 08:06 -0500
    Re: Exceptions handling in pure C "Borneq" <borneq@antyspam.hidden.pl> - 2012-12-07 16:40 +0100
      Re: Exceptions handling in pure C James Kuyper <jameskuyper@verizon.net> - 2012-12-07 11:24 -0500
        Re: Exceptions handling in C + assembler "Borneq" <borneq@antyspam.hidden.pl> - 2012-12-07 18:02 +0100
          Re: Exceptions handling in C + assembler James Kuyper <jameskuyper@verizon.net> - 2012-12-07 12:25 -0500
          Re: Exceptions handling in C + assembler "christian.bau" <christian.bau@cbau.wanadoo.co.uk> - 2012-12-07 09:29 -0800
            Re: Exceptions handling in C + assembler "BartC" <bc@freeuk.com> - 2012-12-08 12:46 +0000
              Re: Exceptions handling in C + assembler James Kuyper <jameskuyper@verizon.net> - 2012-12-08 09:35 -0500
              Re: Exceptions handling in C + assembler Robert Wessel <robertwessel2@yahoo.com> - 2012-12-08 12:08 -0600
                Re: Exceptions handling in C + assembler BGB <cr88192@hotmail.com> - 2012-12-08 15:19 -0600
              Re: Exceptions handling in C + assembler Jonathan Leffler <jleffler@earthlink.net> - 2012-12-16 22:37 -0800
      Re: Exceptions handling in pure C Rosario1903 <Rosario@invalid.invalid> - 2012-12-07 21:24 +0100
  Re: Exceptions handling in pure C Keith Thompson <kst-u@mib.org> - 2012-12-07 11:07 -0800
    Re: Exceptions handling in C + assembler "Borneq" <borneq@antyspam.hidden.pl> - 2012-12-07 20:35 +0100
      Re: Exceptions handling in C + assembler James Kuyper <jameskuyper@verizon.net> - 2012-12-07 15:15 -0500
        Re: Exceptions handling in C + assembler "Borneq" <borneq@antyspam.hidden.pl> - 2012-12-08 16:49 +0100
          Re: Exceptions handling in C + assembler James Kuyper <jameskuyper@verizon.net> - 2012-12-08 11:04 -0500
          Re: Exceptions handling in C + assembler Thomas Richter <thor@math.tu-berlin.de> - 2012-12-09 15:05 +0100
  Re: Exceptions handling in pure C Malcolm McLean <malcolm.mclean5@btinternet.com> - 2012-12-08 10:34 -0800

csiph-web