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
226 additions
and
0 deletions
+226
-0
BM-GJB8114-2013/R-1-10-2/R-1-10-2-good.cpp
BM-GJB8114-2013/R-1-10-2/R-1-10-2-good.cpp
+13
-0
BM-GJB8114-2013/R-1-10-3/R-1-10-3-bad.c
BM-GJB8114-2013/R-1-10-3/R-1-10-3-bad.c
+9
-0
BM-GJB8114-2013/R-1-10-3/R-1-10-3-bad.cpp
BM-GJB8114-2013/R-1-10-3/R-1-10-3-bad.cpp
+9
-0
BM-GJB8114-2013/R-1-10-3/R-1-10-3-good.c
BM-GJB8114-2013/R-1-10-3/R-1-10-3-good.c
+9
-0
BM-GJB8114-2013/R-1-10-3/R-1-10-3-good.cpp
BM-GJB8114-2013/R-1-10-3/R-1-10-3-good.cpp
+9
-0
BM-GJB8114-2013/R-1-10-4/R-1-10-4-bad.c
BM-GJB8114-2013/R-1-10-4/R-1-10-4-bad.c
+12
-0
BM-GJB8114-2013/R-1-10-4/R-1-10-4-bad.cpp
BM-GJB8114-2013/R-1-10-4/R-1-10-4-bad.cpp
+12
-0
BM-GJB8114-2013/R-1-10-4/R-1-10-4-good.c
BM-GJB8114-2013/R-1-10-4/R-1-10-4-good.c
+11
-0
BM-GJB8114-2013/R-1-10-4/R-1-10-4-good.cpp
BM-GJB8114-2013/R-1-10-4/R-1-10-4-good.cpp
+11
-0
BM-GJB8114-2013/R-1-10-5/R-1-10-5-bad.c
BM-GJB8114-2013/R-1-10-5/R-1-10-5-bad.c
+13
-0
BM-GJB8114-2013/R-1-10-5/R-1-10-5-bad.cpp
BM-GJB8114-2013/R-1-10-5/R-1-10-5-bad.cpp
+13
-0
BM-GJB8114-2013/R-1-10-5/R-1-10-5-good.c
BM-GJB8114-2013/R-1-10-5/R-1-10-5-good.c
+13
-0
BM-GJB8114-2013/R-1-10-5/R-1-10-5-good.cpp
BM-GJB8114-2013/R-1-10-5/R-1-10-5-good.cpp
+13
-0
BM-GJB8114-2013/R-1-10-6/R-1-10-6-bad.c
BM-GJB8114-2013/R-1-10-6/R-1-10-6-bad.c
+9
-0
BM-GJB8114-2013/R-1-10-6/R-1-10-6-bad.cpp
BM-GJB8114-2013/R-1-10-6/R-1-10-6-bad.cpp
+9
-0
BM-GJB8114-2013/R-1-10-6/R-1-10-6-good.c
BM-GJB8114-2013/R-1-10-6/R-1-10-6-good.c
+9
-0
BM-GJB8114-2013/R-1-10-6/R-1-10-6-good.cpp
BM-GJB8114-2013/R-1-10-6/R-1-10-6-good.cpp
+9
-0
BM-GJB8114-2013/R-1-11-1/R-1-11-1-bad.c
BM-GJB8114-2013/R-1-11-1/R-1-11-1-bad.c
+14
-0
BM-GJB8114-2013/R-1-11-1/R-1-11-1-bad.cpp
BM-GJB8114-2013/R-1-11-1/R-1-11-1-bad.cpp
+14
-0
BM-GJB8114-2013/R-1-11-1/R-1-11-1-good.c
BM-GJB8114-2013/R-1-11-1/R-1-11-1-good.c
+15
-0
No files found.
BM-GJB8114-2013/R-1-10-2/R-1-10-2-good.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
signed
char
cVar
=
0
;
short
sVar
=
0
;
int
iVar
=
0
;
long
lVar
=
0
;
cVar
=
(
signed
char
)
sVar
;
//遵循1
sVar
=
(
short
)
iVar
;
//遵循2
iVar
=
(
int
)
lVar
;
//遵循3
return
(
0
);
}
BM-GJB8114-2013/R-1-10-3/R-1-10-3-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
double
dData
=
0
.
0
;
float
fData
;
fData
=
dData
;
//违背1
return
(
0
);
}
BM-GJB8114-2013/R-1-10-3/R-1-10-3-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
double
dData
=
0.0
;
float
fData
;
fData
=
dData
;
//违背1
return
(
0
);
}
BM-GJB8114-2013/R-1-10-3/R-1-10-3-good.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
double
dData
=
0
.
0
;
float
fData
;
fData
=
(
float
)
dData
;
//违背1
return
(
0
);
}
BM-GJB8114-2013/R-1-10-3/R-1-10-3-good.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
double
dData
=
0.0
;
float
fData
;
fData
=
(
float
)
dData
;
//违背1
return
(
0
);
}
BM-GJB8114-2013/R-1-10-4/R-1-10-4-bad.c
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
*
ptr
=
NULL
;
unsigned
short
uid
=
0
;
ptr
=
(
unsigned
short
*
)
(
&
uid
);
//违背1
ptr
=
(
&
uid
);
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-10-4/R-1-10-4-bad.cpp
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
*
ptr
=
NULL
;
unsigned
short
uid
=
0
;
ptr
=
(
unsigned
short
*
)
(
&
uid
);
//违背1
ptr
=
(
&
uid
);
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-10-4/R-1-10-4-good.c
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
*
ptr
=
NULL
;
unsigned
short
uid
=
0
;
ptr
=
(
unsigned
int
*
)
(
&
uid
);
//遵循1
return
(
0
);
}
BM-GJB8114-2013/R-1-10-4/R-1-10-4-good.cpp
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
*
ptr
=
NULL
;
unsigned
short
uid
=
0
;
ptr
=
(
unsigned
int
*
)
(
&
uid
);
//遵循1
return
(
0
);
}
BM-GJB8114-2013/R-1-10-5/R-1-10-5-bad.c
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
*
ptr
=
NULL
;
unsigned
int
adr
=
0
;
unsigned
int
uid
=
0
;
ptr
=
adr
;
//违背1
adr
=
&
uid
;
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-10-5/R-1-10-5-bad.cpp
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
*
ptr
=
NULL
;
unsigned
int
adr
=
0
;
unsigned
int
uid
=
0
;
ptr
=
adr
;
//违背1
adr
=
&
uid
;
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-10-5/R-1-10-5-good.c
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
*
ptr
=
NULL
;
unsigned
int
adr
=
0
;
unsigned
int
uid
=
0
;
ptr
=
(
unsigned
int
*
)
adr
;
//遵循1
adr
=
(
unsigned
int
)
(
&
uid
);
//遵循2
return
(
0
);
}
BM-GJB8114-2013/R-1-10-5/R-1-10-5-good.cpp
0 → 100644
View file @
2a291a73
#include <stdlib.h>
int
main
(
void
)
{
unsigned
int
*
ptr
=
NULL
;
unsigned
int
adr
=
0
;
unsigned
int
uid
=
0
;
ptr
=
(
unsigned
int
*
)
adr
;
//遵循1
adr
=
(
unsigned
int
)
(
&
uid
);
//遵循2
return
(
0
);
}
BM-GJB8114-2013/R-1-10-6/R-1-10-6-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
sx
,
sy
=
10
,
sz
;
sx
=
(
unsigned
int
)
sy
+
2
;
//违背1
sz
=
(
unsigned
int
)
(
(
float
)
(
(
sx
+
sy
)
*
2
/
3
)
+
0
.
5
);
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-10-6/R-1-10-6-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
sx
,
sy
=
10
,
sz
;
sx
=
(
unsigned
int
)
sy
+
2
;
//违背1
sz
=
(
unsigned
int
)
(
(
float
)
(
(
sx
+
sy
)
*
2
/
3
)
+
0.5
);
//违背2
return
(
0
);
}
BM-GJB8114-2013/R-1-10-6/R-1-10-6-good.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
sx
,
sy
=
10
,
sz
;
sx
=
sy
+
2
;
//遵循1
sz
=
(
unsigned
int
)
(
(
(
float
)
(
sx
+
sy
)
*
2
/
3
)
+
0
.
5
);
//遵循2
return
(
0
);
}
BM-GJB8114-2013/R-1-10-6/R-1-10-6-good.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
unsigned
int
sx
,
sy
=
10
,
sz
;
sx
=
sy
+
2
;
//遵循1
sz
=
(
unsigned
int
)
(
(
(
float
)
(
sx
+
sy
)
*
2
/
3
)
+
0.5
);
//遵循2
return
(
0
);
}
BM-GJB8114-2013/R-1-11-1/R-1-11-1-bad.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
i
;
float
x
,
y
,
z
;
x
=
z
;
//违背1
if
(
0
==
i
)
//违背2
{
y
=
z
;
//违背3
}
return
(
0
);
}
BM-GJB8114-2013/R-1-11-1/R-1-11-1-bad.cpp
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
i
;
float
x
,
y
,
z
;
x
=
z
;
//违背1
if
(
0
==
i
)
//违背2
{
y
=
z
;
//违背3
}
return
(
0
);
}
BM-GJB8114-2013/R-1-11-1/R-1-11-1-good.c
0 → 100644
View file @
2a291a73
int
main
(
void
)
{
int
i
=
0
;
float
x
,
y
,
z
;
z
=
0
.
0
;
x
=
z
;
//遵循1
if
(
0
==
i
)
//遵循2
{
y
=
z
;
//遵循3
}
return
(
0
);
}
Prev
1
…
3
4
5
6
7
8
9
10
11
…
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