Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Administrator
Public Cpp Test
Commits
2a291a73
Commit
2a291a73
authored
Oct 23, 2023
by
shengnan hu
Browse files
main
parents
Changes
638
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
307 additions
and
0 deletions
+307
-0
BM-GJB8114-2013/R-1-6-2/R-1-6-2-bad.cpp
BM-GJB8114-2013/R-1-6-2/R-1-6-2-bad.cpp
+9
-0
BM-GJB8114-2013/R-1-6-2/R-1-6-2-good.c
BM-GJB8114-2013/R-1-6-2/R-1-6-2-good.c
+9
-0
BM-GJB8114-2013/R-1-6-2/R-1-6-2-good.cpp
BM-GJB8114-2013/R-1-6-2/R-1-6-2-good.cpp
+9
-0
BM-GJB8114-2013/R-1-6-3/R-1-6-3-bad.c
BM-GJB8114-2013/R-1-6-3/R-1-6-3-bad.c
+11
-0
BM-GJB8114-2013/R-1-6-3/R-1-6-3-bad.cpp
BM-GJB8114-2013/R-1-6-3/R-1-6-3-bad.cpp
+11
-0
BM-GJB8114-2013/R-1-6-4/R-1-6-4-bad.c
BM-GJB8114-2013/R-1-6-4/R-1-6-4-bad.c
+16
-0
BM-GJB8114-2013/R-1-6-4/R-1-6-4-bad.cpp
BM-GJB8114-2013/R-1-6-4/R-1-6-4-bad.cpp
+16
-0
BM-GJB8114-2013/R-1-6-4/R-1-6-4-good.c
BM-GJB8114-2013/R-1-6-4/R-1-6-4-good.c
+16
-0
BM-GJB8114-2013/R-1-6-4/R-1-6-4-good.cpp
BM-GJB8114-2013/R-1-6-4/R-1-6-4-good.cpp
+16
-0
BM-GJB8114-2013/R-1-6-5/R-1-6-5-bad.c
BM-GJB8114-2013/R-1-6-5/R-1-6-5-bad.c
+23
-0
BM-GJB8114-2013/R-1-6-5/R-1-6-5-bad.cpp
BM-GJB8114-2013/R-1-6-5/R-1-6-5-bad.cpp
+23
-0
BM-GJB8114-2013/R-1-6-5/R-1-6-5-good.c
BM-GJB8114-2013/R-1-6-5/R-1-6-5-good.c
+30
-0
BM-GJB8114-2013/R-1-6-5/R-1-6-5-good.cpp
BM-GJB8114-2013/R-1-6-5/R-1-6-5-good.cpp
+30
-0
BM-GJB8114-2013/R-1-6-6/R-1-6-6-bad.c
BM-GJB8114-2013/R-1-6-6/R-1-6-6-bad.c
+12
-0
BM-GJB8114-2013/R-1-6-6/R-1-6-6-bad.cpp
BM-GJB8114-2013/R-1-6-6/R-1-6-6-bad.cpp
+12
-0
BM-GJB8114-2013/R-1-6-6/R-1-6-6-good.c
BM-GJB8114-2013/R-1-6-6/R-1-6-6-good.c
+12
-0
BM-GJB8114-2013/R-1-6-6/R-1-6-6-good.cpp
BM-GJB8114-2013/R-1-6-6/R-1-6-6-good.cpp
+12
-0
BM-GJB8114-2013/R-1-6-7/R-1-6-7-bad.c
BM-GJB8114-2013/R-1-6-7/R-1-6-7-bad.c
+10
-0
BM-GJB8114-2013/R-1-6-7/R-1-6-7-bad.cpp
BM-GJB8114-2013/R-1-6-7/R-1-6-7-bad.cpp
+10
-0
BM-GJB8114-2013/R-1-6-8/R-1-6-8-bad.c
BM-GJB8114-2013/R-1-6-8/R-1-6-8-bad.c
+20
-0
No files found.
BM-GJB8114-2013/R-1-6-2/R-1-6-2-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
char
data1
=
256
;
//违背1
signed
char
data2
=
-
129
;
//违背2
//...
return
(
0
);
}
BM-GJB8114-2013/R-1-6-2/R-1-6-2-good.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
short
data1
=
256
;
//遵循1
signed
short
data2
=
-
129
;
//遵循2
//...
return
(
0
);
}
BM-GJB8114-2013/R-1-6-2/R-1-6-2-good.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
short
data1
=
256
;
//遵循1
signed
short
data2
=
-
129
;
//遵循2
//...
return
(
0
);
}
BM-GJB8114-2013/R-1-6-3/R-1-6-3-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
i
=
0
,
j
=
0
;
if
(
i
=
1
)
//违背1
{
j
=
j
+
1
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-6-3/R-1-6-3-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
i
=
0
,
j
=
0
;
if
(
i
=
1
)
//违背1
{
j
=
j
+
1
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-6-4/R-1-6-4-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
x
=
0
,
y
=
1
,
z
=
2
;
if
(
(
x
==
1
)
|
(
y
==
2
)
)
//违背1
{
z
=
3
;
}
if
(
(
x
==
3
)
&
(
y
==
4
)
)
//违背2
{
z
=
5
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-6-4/R-1-6-4-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
x
=
0
,
y
=
1
,
z
=
2
;
if
(
(
x
==
1
)
|
(
y
==
2
)
)
//违背1
{
z
=
3
;
}
if
(
(
x
==
3
)
&
(
y
==
4
)
)
//违背2
{
z
=
5
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-6-4/R-1-6-4-good.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
x
=
0
,
y
=
1
,
z
=
2
;
if
(
(
x
==
1
)
||
(
y
==
2
)
)
//遵循1
{
z
=
3
;
}
if
(
(
x
==
3
)
&&
(
y
==
4
)
)
//遵循2
{
z
=
5
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-6-4/R-1-6-4-good.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
x
=
0
,
y
=
1
,
z
=
2
;
if
(
(
x
==
1
)
||
(
y
==
2
)
)
//遵循1
{
z
=
3
;
}
if
(
(
x
==
3
)
&&
(
y
==
4
)
)
//遵循2
{
z
=
5
;
}
return
(
0
);
}
BM-GJB8114-2013/R-1-6-5/R-1-6-5-bad.c
0 → 100644
View file @
2a291a73
int
fun
(
int
p
);
int
main
(
void
)
{
int
x
=
1
,
y
=
2
,
z
=
3
;
int
r
;
y
=
y
+
(
x
++
);
//违背1
z
=
z
+
(
++
y
);
//违背2
z
=
fun
(
--
z
);
//违背3
r
=
fun
(
z
--
);
//违背4
return
(
0
);
}
int
fun
(
int
p
)
{
int
ret
;
ret
=
2
*
p
;
return
ret
;
}
BM-GJB8114-2013/R-1-6-5/R-1-6-5-bad.cpp
0 → 100644
View file @
2a291a73
int
fun
(
int
p
);
int
main
(
void
)
{
int
x
=
1
,
y
=
2
,
z
=
3
;
int
r
;
y
=
y
+
(
x
++
);
//违背1
z
=
z
+
(
++
y
);
//违背2
z
=
fun
(
--
z
);
//违背3
r
=
fun
(
z
--
);
//违背4
return
(
0
);
}
int
fun
(
int
p
)
{
int
ret
;
ret
=
2
*
p
;
return
ret
;
}
BM-GJB8114-2013/R-1-6-5/R-1-6-5-good.c
0 → 100644
View file @
2a291a73
int
fun
(
int
p
);
int
main
(
void
)
{
int
x
=
1
,
y
=
2
,
z
=
3
;
int
r
;
y
=
y
+
x
;
x
++
;
//遵循1
y
++
;
//遵循2
z
=
z
+
y
;
z
--
;
//遵循3
z
=
fun
(
z
);
r
=
fun
(
z
);
z
--
;
//遵循4
return
(
0
);
}
int
fun
(
int
p
)
{
int
ret
;
ret
=
2
*
p
;
return
ret
;
}
BM-GJB8114-2013/R-1-6-5/R-1-6-5-good.cpp
0 → 100644
View file @
2a291a73
int
fun
(
int
p
);
int
main
(
void
)
{
int
x
=
1
,
y
=
2
,
z
=
3
;
int
r
;
y
=
y
+
x
;
x
++
;
//遵循1
y
++
;
//遵循2
z
=
z
+
y
;
z
--
;
//遵循3
z
=
fun
(
z
);
r
=
fun
(
z
);
z
--
;
//遵循4
return
(
0
);
}
int
fun
(
int
p
)
{
int
ret
;
ret
=
2
*
p
;
return
ret
;
}
BM-GJB8114-2013/R-1-6-6/R-1-6-6-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
x
,
y
,
z
;
x
=
0x00000001
;
y
=
x
<<
33
;
//违背1
x
=
0x80000000
;
z
=
x
>>
33
;
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-6-6/R-1-6-6-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
x
,
y
,
z
;
x
=
0x00000001
;
y
=
x
<<
33
;
//违背1
x
=
0x80000000
;
z
=
x
>>
33
;
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-6-6/R-1-6-6-good.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
x
,
y
,
z
;
x
=
0x00000001
;
y
=
x
<<
1
;
//遵循1
x
=
0x80000000
;
z
=
x
>>
1
;
//遵循2
return
(
0
);
}
BM-GJB8114-2013/R-1-6-6/R-1-6-6-good.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
x
,
y
,
z
;
x
=
0x00000001
;
y
=
x
<<
1
;
//遵循1
x
=
0x80000000
;
z
=
x
>>
1
;
//遵循2
return
(
0
);
}
BM-GJB8114-2013/R-1-6-7/R-1-6-7-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
xdata
=
2
,
ydata
=
3
;
int
sn
=
-
2
;
xdata
=
xdata
<<
-
1
;
//违背1
ydata
=
ydata
>>
sn
;
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-6-7/R-1-6-7-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
xdata
=
2
,
ydata
=
3
;
int
sn
=
-
2
;
xdata
=
xdata
<<
-
1
;
//违背1
ydata
=
ydata
>>
sn
;
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-6-8/R-1-6-8-bad.c
0 → 100644
View file @
2a291a73
void
comp
(
int
a
[
],
int
n
)
//n为数组长度
{
int
i
;
for
(
i
=
0
;
i
<=
n
;
i
++
)
//违背1
{
a
[
i
]
=
0
;
}
}
int
main
(
void
)
{
int
array
[
100
];
comp
(
array
,
100
);
array
[
100
]
=
1
;
//违背2
return
(
0
);
}
Prev
1
…
14
15
16
17
18
19
20
21
22
…
32
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment