Deutsch   English   Français   Italiano  
<vsdm3d$3srps$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Muttley@DastardlyHQ.org
Newsgroups: comp.lang.c++
Subject: Re: Pre-main construction order in modules
Date: Mon, 31 Mar 2025 09:09:01 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <vsdm3d$3srps$1@dont-email.me>
References: <vsb12i$2mv42$1@dont-email.me> <vsbl21$1jsvi$1@dont-email.me>
 <vsbo2p$1p5ov$1@dont-email.me>
 <vsdkuj$3rhjh$1@dont-email.me>
Injection-Date: Mon, 31 Mar 2025 11:09:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="1cf3355fb71ed0c4bc9fadbfaa88c0d7";
	logging-data="4091708"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+WbOi2wn9FgZQ+u4bLyVsj"
Cancel-Lock: sha1:jPOnD5R0p5ZOnnPEU7Lo/ZK+cyo=
Bytes: 1994

On Mon, 31 Mar 2025 11:49:23 +0300
Paavo Helde <eesnimi@osa.pri.ee> wibbled:
>On 30.03.2025 18:30, Muttley@DastardlyHQ.org wrote:
>> On Sun, 30 Mar 2025 10:38:57 -0400
>> James Kuyper <jameskuyper@alumni.caltech.edu> wibbled:
>>> Section 6.9.3.3 does in fact impose many constraints on the sequence in
>>> which non-local objects with static storage duration get initialized.
>>> However, all of the sequence requirements are only between objects
>>> defined in the same translation unit. Also, it's implementation-defined
>>> which of those initializations occur before the start of main().
>> 
>> Initialising global objects before main is an absolute must otherwise how
>> are you expected to use them safely? They're not in the code for decoration.
>
>Initializing global objects before main is not possible with 
>demand-loaded dynamically loaded libraries.

Well obviously, but thats not what I'm talking about. If myobj() is constructed
in a linked .o file I expect it to be available and ready in main(). If not 
then when? Or are you just supposed to guess or hope for the best?