[CLN-list] Global static class instance

Jan Rheinländer jrheinlaender at gmx.de
Sun Jan 15 15:59:14 CET 2023


Hi,

in file include/cln/lfloat_class.h there is the line

     static cl_LF_globals_init_helper cl_LF_globals_init_helper_instance;

Now as far as I can see this will instantiate an instance of class 
cl_LF_globals_init_helper in every object file that includes the header 
(https://stackoverflow.com/questions/11967502/okay-to-declare-static-global-variable-in-h-file 
seems to support this).

Wouldn't it be better to replace static by extern and define the 
instance in some .cc file?

Regards,

Jan Rheinländer


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ginac.de/pipermail/cln-list/attachments/20230115/1be4c8f5/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://www.ginac.de/pipermail/cln-list/attachments/20230115/1be4c8f5/attachment.sig>


More information about the CLN-list mailing list