Open wfs20 opened 1 year ago
initializing this array will cause the memcpy zeroing, or calling constructors for every element
only something like this:
//remove constructors
alignas(cacheline_size) std::atomic<index_t> head = {}; //!< head index
alignas(cacheline_size) std::atomic<index_t> tail = {}; //!< tail index
alignas(cacheline_size) T data_buff[buffer_size] = {}; //!< actual buffer
doesn't emit global constructor (for POD T, on gcc)
//remove constructors
alignas(cacheline_size) std::atomic<index_t> head = {}; //!< head index
alignas(cacheline_size) std::atomic<index_t> tail = {}; //!< tail index
alignas(cacheline_size) T data_buff[buffer_size]; //!< actual buffer
This again emits constructors for intializing head and tail in globals/statics and warning is still there
[[uninitialized]]
of course is not a thing.
At least for POD, llvm recognizes .bss placement and workaround constructor is not necessary.
non POD T constructors are always called
警告 C26495 未初始化变量 jnk0le::Ringbuffer<char const *,256,0,0,unsigned __int64>::data_buff。始终初始化成员变量(type.6)。