Re: x3 static initialisation problems
Dirk Bonekämper <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
> Hope you can clarify what made you post this, so the intended audience > gets interested. Hi Seth, sorry for being obtuse. What I want to say is that the example code in calc7/8/9 for separately compiled rules is prone to the static intialization order fiasco. For example, take calc9/expression_def.hpp. If client::expression() gets called before the local static constructors have run, I see two problems: 1. add_keywords() calls class memnber functions on uninitialized objects 2. expression() returns a reference to an uninitialized object. Possible solutions; 1. call add_keywords() from the ctor of a file local helper object. 2. return a Meyers singleton from expression(). Cheers, Dirk ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot