CPlusPlusThings/learn_class/modern_C++_30/literalAssert/assert.cpp
Light-City 1dca8dee82 update
2020-03-03 11:13:16 +08:00

13 lines
272 B
C++

//
// Created by light on 19-12-25.
//
#include <iostream>
#include <cassert>
int main() {
const int alignment=5;
assert((alignment & (alignment - 1)) == 0);
static_assert((alignment & (alignment - 1)) == 0, "Alignment must be power of two");
return 0;
}