Page 1 of 1

C++ Initialised Static (Class) Variables with Source and Explanation

Posted: Thu Jan 11, 2024 1:19 am
by ql_freak
Believe it or not, it's not possible in C++ before version 17 (inline).

But you can simulate it (I think, this should have had worked even in the first versions C++).

Proud to present a new article on my homepage ([at least] currently only available in English):

http://peter-sulzer.bplaced.net/htdocs/index.php?pagefile=develop/cpp/classVarsWithInit.hti (WARNING: Link opens in SAME Window/Tab, albeit linking to another site!)

Re: C++ Initialised Static (Class) Variables with Source and Explanation

Posted: Thu Jan 11, 2024 11:57 am
by NormanDunbar
ql_freak wrote: Thu Jan 11, 2024 1:19 am
Proud to present a new article on my homepage ([at least] currently only available in English):

http://peter-sulzer.bplaced.net/htdocs/index.php?pagefile=develop/cpp/classVarsWithInit.hti (WARNING: Link opens in SAME Window/Tab, albeit linking to another site!)
I'm getting a 404 page when I follow that link. :(


Cheers,
Norm.

Re: C++ Initialised Static (Class) Variables with Source and Explanation

Posted: Sun Jan 14, 2024 5:58 pm
by Derek_Stewart
Step closer to C++ for the QL!

Re: C++ Initialised Static (Class) Variables with Source and Explanation

Posted: Mon Jan 22, 2024 2:16 am
by ql_freak
NormanDunbar wrote: Thu Jan 11, 2024 11:57 am I'm getting a 404 page when I follow that link. :(
Oops, I have thought, I have had answered this problem. Please try:

Code: Select all

http://peter-sulzer.bplaced.net/htdocs/index.php?pagefile=develop/cpp/classVarsWithInit.hti
If it does not work go to my homepage (see my footer), click on the black triangle before "Softwareentwicklung" and in the pop down menu click on:

C++ Class Variables

(There is a British flag before the menu entry)

Sincerely

Peter

Re: C++ Initialised Static (Class) Variables with Source and Explanation

Posted: Mon Jan 22, 2024 8:38 am
by tofro
This may be a non-problem for modern C++ (if this can be handled at all in a QL forum), because these days singletons have become highly out-of-fashion (Mainly for the reason that they are just global variables in disguise, with all their downsides).

Re: C++ Initialised Static (Class) Variables with Source and Explanation

Posted: Mon Jan 22, 2024 11:43 am
by NormanDunbar
ql_freak wrote: Mon Jan 22, 2024 2:16 am
NormanDunbar wrote: Thu Jan 11, 2024 11:57 am I'm getting a 404 page when I follow that link. :(
Oops, I have thought, I have had answered this problem.
Hi Peter,

it is indeed fixed on the original URL. Thanks.


Cheers,
Norm.