Skip to content

Instantly share code, notes, and snippets.

@bkase
Created December 10, 2014 22:53
Show Gist options
  • Save bkase/8afc20abbbe5730b8b3a to your computer and use it in GitHub Desktop.
Save bkase/8afc20abbbe5730b8b3a to your computer and use it in GitHub Desktop.
Assertion code in swift std library
/// User code assertions.
///
/// User code assertions and fatal errors are only enabled in debug mode. In
/// release or fast mode these checks are disabled. This means they may have no
/// effect on program semantics, depending on the assert configuration.
/// Traditional C-style assert with an optional message.
///
/// When assertions are enabled and `condition` is false, stop program
/// execution in a debuggable state after printing a message. When
/// assertions are disabled in release and fast builds, `condition` is not even
/// evaluated.
///
/// When assertions are turned off, the optimizer can assume that the
/// `condition` is true.
func assert(condition: @autoclosure () -> Bool, _ message: @autoclosure () -> String = default, file: StaticString = default, line: UWord = default)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment