Skip to content

Instantly share code, notes, and snippets.

@illescasDaniel
Created November 26, 2016 15:59
Show Gist options
  • Select an option

  • Save illescasDaniel/55dddcd9a8d1682d6b48c9859cd7cc0e to your computer and use it in GitHub Desktop.

Select an option

Save illescasDaniel/55dddcd9a8d1682d6b48c9859cd7cc0e to your computer and use it in GitHub Desktop.
Assert [C++]
#include <iostream>
#include <cassert>
using namespace std;
int main(int argc, char *argv[]) {
uint16_t number1 = 10, number2 = 20;
assert(number1 + number2 == 30);
// Expression is evaluated at compile time
constexpr int number3 = 5, number4 = 6;
static_assert(number4 - number3 == 1, "Error"); // Expression must be const / constexpr
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment