Experimental Physics and Industrial Control System
Am Montag, 23. Mai 2011, um 21:33:42 schrieb Jim Thomas:
> >>>>> "Dirk" == Dirk Zimoch <[email protected]> writes:
> >> [...] One exception frequently cited is when starting an IOC its maybe
> >> ok, but if this occurs in common library code then it's probably going
> >> to be used inappropriately in other situations, and surely eventually
> >> we will need to upgrade allowing online add and delete of records and
> >> then it's less clear when iocInit starts and ends?
>
> Dirk> This show why C++ exceptions are better than the good old C abort().
>
> Sorry, but an exception is only a fancy goto. There is little new .....
It is not "new" in any way, considering what LISP and others offered decades
before C++, but it is still not a goto (however fancy) because where you throw
the exception you don't have to say where it should go to, the stack gets
unwound until a try with a matching handler is found. This is what makes
exceptions much more powerful than goto, the control flow is determined by the
caller as well as the callee. You could emulate this in C only by threading
through *every* procedure an extra parameter (a stack of handlers plus
environment), adding a new frame (handler+env) each time you would use a
try/catch. This is possible but only at the expense of a large overhead, at
run-time as well as in lines of code (which is why nobody uses this pattern in
C).
Cheers
Ben
________________________________
Helmholtz-Zentrum Berlin für Materialien und Energie GmbH
Mitglied der Hermann von Helmholtz-Gemeinschaft Deutscher Forschungszentren e.V.
Aufsichtsrat: Vorsitzender Prof. Dr. Dr. h.c. mult. Joachim Treusch, stv. Vorsitzende Dr. Beatrix Vierkorn-Rudolph
Geschäftsführer: Prof. Dr. Anke Rita Kaysser-Pyzalla, Prof. Dr. Dr. h.c. Wolfgang Eberhardt, Dr. Ulrich Breuer
Sitz Berlin, AG Charlottenburg, 89 HRB 5583
Postadresse:
Hahn-Meitner-Platz 1
D-14109 Berlin
http://www.helmholtz-berlin.de
- References:
- caGateway crashes / use of *MustSucceed functions Dirk Zimoch
- Re: caGateway crashes / use of *MustSucceed functions Dirk Zimoch
- Re: caGateway crashes / use of *MustSucceed functions Jim Thomas
- Navigate by Date:
- Prev:
Re: caGateway crashes / use of *MustSucceed functions Jim Thomas
- Next:
Re: vxWorks network problems Andrew Johnson
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
Re: caGateway crashes / use of *MustSucceed functions Jim Thomas
- Next:
Re: caGateway crashes / use of *MustSucceed functions Benjamin Franksen
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024