I tested the statements in Swift, but I'm a bit confused. Could you explain to me the difference between the functions assert, assertionFailureand fatalError?
I know about the attribute @noreturn( beautifully explained by Seven Oglesby), but I don't understand when these functions are evaluated and when they are ignored.
Functions assertand fatalErroroccurred only in debug mode, I tested this behavior, and this is true. But assertionFailurealso stops the program in the release configuration. The documentation remains:
A fatal error has occurred, and program execution should stop in debug mode. In optimized builds, this is noop.
Then I do not understand why this method is not ignored in non-debug mode. Does anyone have any experience?
source
share