Skip to content

replace assert functions  #4

@ferdymercury

Description

@ferdymercury

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions