Liste des Groupes | Revenir à cl c++ |
On Mon, 31 Mar 2025 11:49:23 +0300The standard does not talk specifically about dynamic libraries, so the same rules apply for the main program. This means the same quote you snipped is relevant to your myobj as well:
Paavo Helde <eesnimi@osa.pri.ee> wibbled:On 30.03.2025 18:30, Muttley@DastardlyHQ.org wrote:Well obviously, but thats not what I'm talking about. If myobj() is constructedOn 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.
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?
Les messages affichés proviennent d'usenet.