eidelen / DicomToMesh

A command line tool to transform a DICOM volume into a 3d surface mesh (obj, stl or ply). Several mesh processing routines can be enabled, such as mesh reduction, smoothing or cleaning. Works on Linux, OSX and Windows.
MIT License
437 stars 91 forks source link

Catch exceptions in main()? #22

Open elfring opened 4 years ago

elfring commented 4 years ago

I expect that exception handling is usually supported by a C++ program. I wonder why your function “main” does not contain corresponding try and catch instructions so far.

How do you think about recommendations by Matthew Wilson in an article?

Would you like to adjust the implementation if you consider effects for uncaught/unhandled exceptions?

eidelen commented 4 years ago

Hi Markus, Thank you for your recommendations. I know about exception handling in C++, and I used it here and there. I feel that in my everyday programming I apply it far too less. Rather than just catching the exception in the main, I would prefer to implement a proper exception handling throughout the whole application - starting deep down in code where they actually occur. Would you be willing to participate in that work? Adrian

elfring commented 4 years ago

I would like to achieve a bit also in such a software area. The application of C++ exceptions can eventually be improved further.

How should a production-quality main() function look like?