[ros-general] How can I copy code from ReactOS to mingw-w64?

LIU Hao lh_mouse at 126.com
Thu Mar 17 04:00:56 UTC 2022


在 2022/3/16 10:58, Thomas Faber 写道:
> Change is made:
> https://github.com/reactos/reactos/commit/be336316295278be728ea81156f77e24e7ed193a
> 
> Let us know if there's anything else we can help with.
> 
> 

While examining the `ConvertBSTRToString()` function, I noticed some issues in it. (I am not sure 
whether this is a correct place to ask, but I decide not to cross post.)

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[...]`?

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?


[1] https://docs.microsoft.com/en-us/cpp/cpp/convertbstrtostring?view=msvc-170



-- 
Best regards,
LIU Hao
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 840 bytes
Desc: OpenPGP digital signature
URL: <http://reactos.org/pipermail/ros-general/attachments/20220317/d40077a6/attachment.sig>


More information about the Ros-general mailing list