zeroc-ice / ice

All-in-one solution for creating networked applications with RPC, pub/sub, server deployment, and more.
https://zeroc.com
GNU General Public License v2.0
2.05k stars 593 forks source link

Eliminate catch(const char*) #48

Closed bernardnormier closed 7 months ago

bernardnormier commented 6 years ago

We should not throw or catch C-strings (or any type not derived from std::exception), yet we have quite a number of catch(const char*) in the code:

./python/modules/IcePy/Slice.cpp:    catch(const char* msg)
./cpp/src/IceGrid/Client.cpp:    catch(const char* msg)
./cpp/src/IceGrid/Topics.cpp:    catch(const char* msg)
./cpp/src/slice2py/Main.cpp:    catch(const char* msg)
./cpp/src/Glacier2Lib/Application.cpp:    catch(const char* ex)
./cpp/src/slice2cs/Main.cpp:    catch(const char* msg)
./cpp/src/slice2java/Main.cpp:    catch(const char* msg)
./cpp/src/slice2cpp/Main.cpp:    catch(const char* msg)
./cpp/src/slice2html/Main.cpp:        catch(const char* err)
./cpp/src/slice2html/Main.cpp:    catch(const char* msg)
./cpp/src/IcePatch2/Calc.cpp:    catch(const char* ex)
./cpp/src/slice2confluence/Main.cpp:        catch(const char* err)
./cpp/src/slice2confluence/Main.cpp:    catch(const char* msg)
./cpp/src/slice2js/Main.cpp:    catch(const char* msg)
./cpp/src/Ice/Service.cpp:    catch(const char* msg)
./cpp/src/Ice/PluginManagerI.cpp:                catch(const char* msg)
./cpp/src/Ice/Application.cpp:    catch(const char* msg)
./cpp/src/Ice/Application.cpp:    catch(const char* msg)
./cpp/src/slice2php/Main.cpp:    catch(const char* msg)
./cpp/src/slice2matlab/Main.cpp:    catch(const char* msg)
./cpp/src/slice2rb/Main.cpp:    catch(const char* msg)
./cpp/src/slice2objc/Main.cpp:    catch(const char* msg)
./ruby/src/IceRuby/Slice.cpp:        catch(const char* msg)

ICE-8639

pepone commented 6 years ago

I think we have to keep a few of them at least for 3.7

./cpp/src/Glacier2Lib/Application.cpp:    catch(const char* ex)
./cpp/src/Ice/Service.cpp:    catch(const char* msg)
./cpp/src/Ice/PluginManagerI.cpp:                catch(const char* msg)
./cpp/src/Ice/Application.cpp:    catch(const char* msg)
./cpp/src/Ice/Application.cpp:    catch(const char* msg)

Removing this could break applications that work fine with 3.7.1

pepone commented 6 years ago

I remove most of the occurrences just keep the ones mentioned above for compatibility. We can remove the rest for 3.8