Re: link order

Felix Salfelder <[email protected]>
Newsgroups gmane.comp.gnu.gnucap.devel
Message-ID <[email protected]>
On Sat, Jun 29, 2019 at 03:28:29PM +1200, Christian Gagneraud wrote:
> > [..] static objects are initialised to zero.
> No, that is not mandated by the C++ standard.

Hi Christian.

this is interesting.

can you give a reference to this? here [1] they tell the opposite.  your
claim is, if i understand, that static variables are not necessarily
initialised to zero (note "initialisation" vs "construction").

> You should either:
>  explicitly initialise the member when declaring it, eg std::map<X, Y>
> *m_map = nullptr;

what is the effect of std::map<X, Y> *m_map = nullptr;?
are there multiple layers of construction in a newer C++? then i suggest
to pass -std=c++98 (or c++11?) to the compiler, and see if it works.

> or even better, do not use pointer to map, just use map.
> But i guess you tried and it didn't work.

yes it does, but it does not print an error in case the link order is
wrong anymore. here's the pending commit [2], with the open question
"(is there a better way?)". help appreciated!

cheers
felix

[1] https://stackoverflow.com/questions/2091499/why-are-global-and-static-variables-initialized-to-their-default-values
[2] https://git.savannah.gnu.org/cgit/gnucap.git/commit/?h=pending&id=847095f7965e4f92e8c124817c8f855f560387dd

_______________________________________________
Gnucap-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/gnucap-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.