Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit808b5fd

Browse files
committed
Fix cases
1. Change signed char / int8_t case to their opposites.2. Assign a numeral to the unsigned char / signed char than a character.
1 parentfb54487 commit808b5fd

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎cpp/autosar/test/rules/M5-0-12/test.cpp‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ void f12(std::int8_t x) {}
7878

7979
template<typename T>voidf5(T x) {unsignedchar y = x; }
8080
template<typename T>voidf6(T x) {signedchar y = x; }
81-
template<typename T>voidf7(T x) {signedchar y = x; }
81+
template<typename T>voidf7(T x) {unsignedchar y = x; }
8282
template<typename T>voidf8(T x) {signedchar y = x; }
8383

8484
/* Twin template functions for std::uint8_t and std::int8_t*/
8585
template<typename T>voidf13(T x) { std::uint8_t y = x; }
8686
template<typename T>voidf14(T x) { std::int8_t y = x; }
87-
template<typename T>voidf15(T x) { std::int8_t y = x; }
87+
template<typename T>voidf15(T x) { std::uint8_t y = x; }
8888
template<typename T>voidf16(T x) { std::int8_t y = x; }
8989

9090
template<typename T>classC9 {
@@ -286,33 +286,33 @@ int main() {
286286
/* ===== 2-2. Passing char argument to a char parameter through a template
287287
* =====*/
288288

289-
unsignedchar a9 ='a';
289+
unsignedchar a9 =1;
290290
f5(a9);// COMPLIANT: unsigned char arg passed to an unsigned char parameter
291291
// through a template
292292

293-
signedchar a10 ='a';
293+
signedchar a10 =1;
294294
f6(a10);// COMPLIANT: signed char arg passed to a signed char parameter
295295
// through a template
296296

297297
char a11 ='a';
298-
f7(a11);// NON-COMPLIANT: plain char arg passed toa signed char parameter
298+
f7(a11);// NON-COMPLIANT: plain char arg passed toan unsigned char parameter
299299
// through a template
300300

301301
char a12 ='a';
302302
f8(a12);// NON-COMPLIANT: plain char arg passed to a signed char parameter through
303303
// a template
304304

305305
/* Twin cases with std::uint8_t and std::int8_t*/
306-
std::uint8_t a13 ='a';
306+
std::uint8_t a13 =1;
307307
f13(a13);// COMPLIANT: std::uint8_t arg passed to a std::uint8_t parameter
308308
// through a template
309309

310-
std::int8_t a14 ='a';
310+
std::int8_t a14 =1;
311311
f14(a14);// COMPLIANT: std::int8_t arg passed to a std::int8_t parameter
312312
// through a template
313313

314314
char a15 ='a';
315-
f15(a15);// NON-COMPLIANT: plain char arg passed to a std::int8_t parameter
315+
f15(a15);// NON-COMPLIANT: plain char arg passed to a std::uint8_t parameter
316316
// through a template
317317

318318
char a16 ='a';

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp