> new (thd) char[size] ();
>
> Note the brackets before the semicolon -- they force zero
> initialization for scalar types, as well as for POD types:
did you test that it works?
Yes, I did.
And even better news that
new (thd) char[size] {};
looks much better, and also works just the same.
> Apparently, one can't put a global operator new/delete definition into
> a header: then a linker finds duplicates:(
even if you declare them static inline?
you can't make global operator new static :(
you actually can't do it inline (without static) either, at least, formally. But I tried:
inline
void* operator new(size_t size){ return malloc(size); }
inline
void operator delete(void *ptr) noexcept { free(ptr); };