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


Groups > comp.lang.c > #29083

Re: Exceptions handling in C + assembler

From BGB <cr88192@hotmail.com>
Newsgroups comp.lang.c
Subject Re: Exceptions handling in C + assembler
Date 2012-12-08 15:19 -0600
Organization albasani.net
Message-ID <ka0b19$e47$1@news.albasani.net> (permalink)
References (3 earlier) <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> <t907c85vl2acdkicifo6563pgl12vj2c2q@4ax.com>

Show all headers | View raw


On 12/8/2012 12:08 PM, Robert Wessel wrote:
> On Sat, 8 Dec 2012 12:46:29 -0000, "BartC" <bc@freeuk.com> wrote:
>
>>
>>
>> "christian.bau" <christian.bau@cbau.wanadoo.co.uk> wrote in message
>> news:71d8f792-698f-4740-9841-4a587eb00f91@u19g2000yqj.googlegroups.com...
>>> There are situations where it doesn't make sense to say "how do I do
>>> this C++ thing in C"; the proper answer would be "just do it in C++".
>>> Exception handling is one of those things.
>>
>> Yet C++ was originally implemented in C?
>
>
> Cfront (Stroustrup's original C++ to C translator) was abandoned when
> it became obvious that adding exceptions (which were a fairly late
> addition to C++), was near impossible.  So Cfront never supported
> exceptions.
>

and, apparently no one considered doing it like something like this:

if(ehBeginTry())
{
	... do stuff ...
	ehEndTry();
}else if(ehCatch("SomeException"))
{
	... handle stuff ...
	ehEndCatch();
}else
...
}else if(ehBeginFinally())
{
	... cleanup ...
	ehEndFinally();		//continues unwinding
}


where "ehBeginTry()" would register the exception-handler, and 
"ehEndTry()" would unregister it.

the "ehBeginTry()" return value will indicate whether they are entering 
the "try" block, or handling a thrown exception.


in cases where resources need to be cleaned up, a block can be written like:
if(ehBeginTry())
{
	... do stuff ...
	ehEndTry();
}else if(ehBeginFinally())
{
	... cleanup ...
	ehEndFinally();
}



or such...

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