먼저이 메시지는 How are integer types converted implicitly?과 유사하지만 MISRA 경고가 다릅니다.MISRA Violation Rule 10.1 및 Enums
컴파일러는 MISRA 오류를 생성하지 않지만 정적 분석 도구는 생성합니다. 진행중인 공구 제조업체의 티켓이 있습니다.
감안할 :
#include <stdio.h>
enum Color {RED, VIOLET, BLUE, GREEN, YELLOW, ORANGE};
int main(void)
{
enum Color my_color;
my_color = BLUE;
if (my_color == YELLOW) // Generates MISRA violation, see below.
{
printf("Color is yellow.\n");
}
else
{
printf("Color is not yellow.\n");
}
return 0;
}
정적 분석 도구 if
진술하는 MISRA 위반이 발생된다
MISRA-2004 Rule 10.1 violation: implicitly changing the signedness of an expression.
Converting "4", with underlying type "char" (8 bits, signed),
to type "unsigned int" (32 bits, unsigned) with different signedness.
컴파일러 정확하거나 정적 분석 도구 (결함을 식별하지 않음)?
같은 코드, 동일한 오류, 오류 보고서는 조금 더 말 수가 많은. 코드 스 니펫간에 차이점은 없습니다. – Mat
나는 당신이 당신의 툴 - 벤더로부터 어떤 답장을 받았는지에 대해 알고 싶지만 툴이 고장난 것처럼 보입니다. – Andrew