在 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

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

_______________________________________________
Ros-general mailing list
Ros-general@reactos.org
http://reactos.org/mailman/listinfo/ros-general

Reply via email to