![]() |
![]() |
1257 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Assignment | |||||||
This message is issued whenever a suffixed integer constant undergoes an assigning conversion to an integral type of lower rank. Consider removing (some) suffixes. For example:
/*PRQA S 1-9999 ++*/
/*PRQA S 1257 --*/
/**********************************
* OPTIONS: -ex LONGLONG
*********************************/
extern int sia;
extern unsigned int uia;
extern long sla;
extern unsigned long ula;
void foo (int a);
int f1257 (void)
{
sia = 5L; /* 1257 */
uia = 5L; /* 1257 */
sia = 5UL; /* 1257 */
uia = 5UL; /* 1257 */
sia = 5LL; /* 1257 */
uia = 5LL; /* 1257 */
sla = 5LL; /* 1257 */
ula = 5LL; /* 1257 */
sia = 5ULL; /* 1257 */
uia = 5ULL; /* 1257 */
sla = 5ULL; /* 1257 */
ula = 5ULL; /* 1257 */
foo (5LL); /* 1257 */
return 5L; /* 1257 */
}
MISRA C:2012 Rules applicable to message 1257:
| Rule-10.3 (Required) | The value of an expression shall not be assigned to an object with a narrower essential type or of a different essential type category. |
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |