mirror of
https://github.com/Light-City/CPlusPlusThings.git
synced 2026-02-03 10:33:25 +08:00
support bazel complie this project and format code.
This commit is contained in:
14
learn_class/modern_cpp_30/literalAssert/assert.cpp
Normal file
14
learn_class/modern_cpp_30/literalAssert/assert.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// Created by light on 19-12-25.
|
||||
//
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
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;
|
||||
}
|
||||
Reference in New Issue
Block a user