Sunday, August 9, 2020

Digest for comp.lang.c++@googlegroups.com - 2 updates in 1 topic

Juha Nieminen <nospam@thanks.invalid>: Aug 08 11:33PM

> }
 
> Calling getFred() from any translation unit makes the right thing will
> happen. Ditto for Barney.
 
Just take into account that that will create a conditional with
thread-safe locking, which is used every time getFred() is called.
 
(I don't know what kind of solution compiles will usually use for
this. Perhaps some kind of atomic variable. But either way, it won't
be zero-cost, and it most probably won't be even as "cheap" as a
regular if-conditional.)
 
If maximum efficiency is not a concern with this, then by all means.
If you need to squeeze every single clock cycle out of it, then it's
not the best possible solution.
thomas.healy1987@gmail.com: Aug 09 02:36AM -0700

On Saturday, 8 August 2020 19:42:44 UTC+2, Sam wrote:
> }
 
> Calling getFred() from any translation unit makes the right thing will
> happen. Ditto for Barney.
 
 
in some cases this can cause the static de-initialisation fiasco
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

No comments: