Re: x3 static initialisation problems
Joel de Guzman <[email protected]>
| Newsgroups | gmane.comp.parsers.spirit.general |
|---|---|
| Message-ID | <[email protected]> |
On 11/12/2017 4:10 AM, Dirk Bonekämper wrote: > >> 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(). I'm having difficulties with the mailing list. This is my third attempt to reply to this thread. I hope it gets in. Well, I wrote the examples, so I should know. Very good points, actually. If you have a PR, that would be good. Otherwise, I'll try to get some time to fix it. Thanks! Regards, -- Joel de Guzman http://www.ciere.com http://boost-spirit.com http://www.cycfi.com/ ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Spirit-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/spirit-general