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
[email protected]
- 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
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- 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
<2011>
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|