Re: omniORB: Remove unnecessary null pointer checks
Duncan Grisby via omniORB-dev <[email protected]> Thu, 02 Nov 2023 15:58:14 +0000
| Newsgroups | gmane.comp.corba.omniorb.devel |
|---|---|
| Message-ID | <[email protected]> |
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 -- -- [email protected] -- -- http://www.grisby.org --