[omniORB-dev] omniORB: Remove unnecessary null pointer checks
Duncan Grisby
duncan at grisby.org
Thu Nov 2 15:58:14 UTC 2023
On Sun, 2023-10-29 at 17:22 +0100, Markus Elfring via omniORB-dev
wrote:
> An extra null pointer check is not needed in functions like the
> following.
> https://isocpp.org/wiki/faq/freestore-mgmt#delete-handles-null
>
> * Destructor for omni_thread
It's not needed with a standard-compliant C++ compiler, but a lot of
this code was written very long ago when there were many differences
between how different compilers behaved, and some compilers did not
gracefully handle deletion of null pointers.
Modern C++ compilers generate exactly the same code regardless of
whether there is a null-check before delete or not, so there is no
value in changing this. Also, omniORB still targets some ancient
environments with ancient C++ compilers, so it would be very hard to be
sure that changing this would not break something.
Do you have a specific reason for running this sort of analysis on
omniORB's code, or are you just doing it out of interest?
Duncan.
--
-- Duncan Grisby --
-- duncan at grisby.org --
-- http://www.grisby.org --
More information about the omniORB-dev
mailing list