Hi again,
On 2022-03-17 00:00, LIU Hao wrote:
1) According to MS docs [1], `ConvertBSTRToString()`
returns a string
that the user must delete via `delete[]`, so why is the returned
buffer allocated via `::operator new()`, instead of `new char[...]`?
I think this only makes a difference in terms of how
constructors/destructors are called, so shouldn't matter for an array of
chars.
I'm not sure whether there's any particular advantage here to calling
the operator directly rather than the more obvious new[]. So it could
make sense to change it.
2) `::operator new()` throws an exception on failure
and never returns
a null pointer. This makes the null check about its return value
unnecessary. Is it supposed to be `::new(::std::nothrow) char[...]`?
Or do we ignore such circumstances?
I think this is a bug and we should indeed be calling the nothrow operator.
Best,
Thomas