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 | 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 |
<== Date ==> | <== Thread ==> |
---|
Subject: | Re: caGateway crashes / use of *MustSucceed functions |
From: | Dirk Zimoch <[email protected]> |
To: | Jeff Hill <[email protected]> |
Cc: | "'EPICS Tech Talk'" <[email protected]> |
Date: | Mon, 23 May 2011 10:18:11 +0200 |
[...] 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 ofrecords and then it's less clear when iocInit starts and ends?
This show why C++ exceptions are better than the good old C abort(). If creation of a new record fails because of insufficient memory, an exception can be thrown. During run-time it should be caught and an error should be reported to the user that the record can't be added to the system. During initialization, it may be acceptable not to catch the exception which will in the end call abort(). Thus the application developer and not the support library developer decides if the application (here the ioc) must die or not.
By the way, if creation of a record fails because of a typo in a template file, the ioc happily continues starting up, but with one or many records missing -- even though this *is* a programming error, not a run-time problem.
Dirk