forked from chronolaw/professional_boost
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsafety.cpp
81 lines (59 loc) · 1.09 KB
/
safety.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// Copyright (c) 2016
// Author: Chrono Law
#include <std.hpp>
using namespace std;
#include <boost/core/ignore_unused.hpp>
///////////////////////////////////////
void func() noexcept
{}
///////////////////////////////////////
namespace {
int x = 0;
}
inline namespace temp{
int xx = 0;
}
namespace release {
namespace v001 {
void func() {}
}
inline namespace v002 {
void func() {}
}
}
void case1()
{
assert(x == 0);
assert(xx == 0);
release::func();
}
///////////////////////////////////////
enum class color : char {
red = 1,
green = 2,
blue = 3
};
void case2()
{
//int red = 1;
//assert(red == green -1);
auto x = color::red;
//auto y = red;
//auto z = color::red + 1;
boost::ignore_unused(x);
}
///////////////////////////////////////
void case3()
{
[[deprecated]] int x = 0;
class [[deprecated]] demo {};
boost::ignore_unused(x);
}
///////////////////////////////////////
int main()
{
std::cout << "hello C++11/14 safety features" << std::endl;
case1();
case2();
case3();
}