-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIfDecInc.cpp
44 lines (32 loc) · 936 Bytes
/
IfDecInc.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
/**
* \file IfDecInc.cpp
* \brief If with post/pre increment operators
*
* If i == 0 - ++ i would increment before evaluation, i ++ increments - after
*/
#include <StdStream/StdStream.h>
#include <StdTest/StdTest.h>
#include <Stl.h>
//--------------------------------------------------------------------------------------------------
int main(int, char **)
{
int n {};
std::cout << "[#1] " << STD_TRACE_VAR(n) << std::endl;
if (n ++) {
std::cout << "[#2] " << STD_TRACE_VAR(n) << std::endl;
}
std::cout << "[#3] " << STD_TRACE_VAR(n) << std::endl;
if (n --) {
std::cout << "[#4] " << STD_TRACE_VAR(n) << std::endl;
}
std::cout << "[#5] " << STD_TRACE_VAR(n) << std::endl;
return EXIT_SUCCESS;
}
//--------------------------------------------------------------------------------------------------
#if OUTPUT
[#1] n: 0
[#2] - skip
[#3] n: 1
[#4] n: 0
[#5] n: 0
#endif