Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
<== Date ==> <== Thread ==>

Subject: Re: c++ static initialization
From: Eric Norum <eric@norum.ca>
To: EPICS core-talk <core-talk@aps.anl.gov>
Date: Tue, 9 Aug 2011 15:54:44 -0700
On Aug 9, 2011, at 3:24 PM, Benjamin Franksen wrote:

> Hi Jeff
> 
> you asked for opinions, here is mine:
> ......
> 
> (1) Static objects should be avoided wherever possible.
> 
> (2) If static objects are used, the constructor should be trivial, i.e. not
> perform anything except setting members to default values.

Static initializers are often used to register iocsh commands.   I think that this is acceptable and should be documented as such.

> 
> (3) Non-trivial initialization for complex objects should be done in a regular
> method either lazily ("Construct On First Use") or by an explicit call from
> some startup routine. The latter has the advantage of a well-defined order of
> initialization; the former is sometimes more convenient.
> ......

-- 
Eric Norum
eric@norum.ca






References:
c++ static initialization Jeff Hill
Re: c++ static initialization Benjamin Franksen

Navigate by Date:
Prev: Re: c++ static initialization Hill, Bruce
Next: Re: [Merge] lp:~epics-core/epics-base/epicsR3.15-atomics into lp:epics-base mdavidsaver
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
Navigate by Thread:
Prev: Re: c++ static initialization Benjamin Franksen
Next: Re: c++ static initialization Andrew Johnson
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  <20112012  2013  2014  2015  2016  2017  2018  2019  2020 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·