[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnucap-devel] Feedback needed, especially non-Linux

From: David Fang
Subject: Re: [Gnucap-devel] Feedback needed, especially non-Linux
Date: Thu, 22 Feb 2007 21:56:26 -0500 (EST)

> It gives me an idea ...  Where it now prints "improper link
> order", construct it.  Instead of a map, have a pointer to map,
> use new and delete.  It is the map that needs initializing.

        Taking a line from perl (which I detest): there's more than one
way to do it.

If you only care about initializing the map early enough, and don't care
about its time of destruction, then using a simple boolean guard
(_initialized) to construct the map once will do fine.  If you need to
remove entries from the map in an orderly manner (perhaps during global
destruction?), then using a reference-count will keep the map from
destroyed before removing map entries.  Looks like 'uninstall' is intended
for this.  If you want to be lazy and just ignore uninstalls after the
destruction/nullification of the map, that could work too.

> > I've witnessed at least one system where the order of
> > translation unit global destruction is *not* the reverse of
> > the ordering chosen in initialization.  :(
> I am aware of one, from long ago.  The destruction order was
> exactly the construction order.  Perfectly wrong.

Wrong in principle, but honestly, I don't know if there's a law against
that either (for translation units).  If I looked it up years ago, I've
forgotten!  I just make sure that I manage ordering dependencies
explicitly, and leave nothing to happenstance.

> > Nevertheless,
> > using the ios_base::Init technique should be robust to even
> > the most nonsensical TU-orderings!
> I am not sure, but I see a way to test it.
> Thanks.  I will try it.

Great, looking forward to the next update.  Let me know if you need
another pair of eyes, testing, or would like me to write a patch.

David Fang
Computer Systems Laboratory
Electrical & Computer Engineering
Cornell University
        -- (2400 baud? Netscape 3.0?? lynx??? No problem!)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]