Why is std::hardware_destructive_interference_size a Compile-time Constant ... -- Raymond Chen
C++17 added a new compile time constant std:: which tells you (basically) the size of a cache line. The purpose of this is to allow you to lay out your structures in a way that avoids false sharing.
Why is
std::hardware_destructive_interference_sizea Compile-time Constant Instead of a Run-time Value?by Raymond Chen
From the article:
C++17 added a new compile time constant
std::which tells you (basically) the size of a cache line. The purpose of this is to allow you to lay out your structures in a way that avoids false sharing.¹hardware_ destructive_ interference_ size But how does the compiler know what the cache line size will be of the CPU the program will eventually be run on? Shouldn’t this be a run-time value instead of a compile-time value?
Well yes, the actual size of the cache line isn’t know until run-time, because it is only then that the program meets a CPU. But really, you want this to be a ...

Registration is now open for CppCon 2023! The conference starts on October 1 and will be held
Event-driven applications, such as GUIs or servers, often apply the architecture pattern Reactor. A Reactor can accept multiple requests simultaneously and distribute them to different handlers.
Registration is now open for CppCon 2023! The conference starts on October 1 and will be held
Last time I showed a couple of questions about initialization. Try them
Registration is now open for CppCon 2023! The conference starts on October 1 and will be held
During the construction of an XML file when you write an element, it is obvious that the last thing that you do is to write the closing tag. By obvious we mean: writing it down adds no new information (there is no other possible final instruction for this task), and it would be a bug if this instruction wasn’t there.
In a previous
Registration is now open for CppCon 2023! The conference starts on October 1 and will be held