topasmc / dicom-interface

DICOM RT Interface for TOPAS
MIT License
23 stars 9 forks source link

replace assert functions #4

Open ferdymercury opened 4 years ago

ferdymercury commented 4 years ago

As assert() functions does not get called in release mode by default.

Simple solution could be:

#define ASSERT(e) ((e) ? (void)0 : ((void)printf ("%s:%u: failed assertion `%s'\n", FILE, LINE, #e), abort())))

Or with throw std::runtime_error

Other options: https://stackoverflow.com/questions/620892/how-to-put-assert-into-release-builds-in-c-c https://www.softwariness.com/articles/assertions-in-cpp/ http://www.drdobbs.com/assertions/184403861 https://developer.apple.com/swift/blog/?id=4