gnucap-devel
[Top][All Lists]
Advanced

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

Re: [Gnucap-devel] link order


From: Felix Salfelder
Subject: Re: [Gnucap-devel] link order
Date: Sat, 29 Jun 2019 10:44:38 +0200
User-agent: NeoMutt/20170113 (1.7.2)

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



reply via email to

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