![]() |
![]() |
1443 | ![]() |
||||
![]() | |||||||
| Arithmetic type - Enum types | REFERENCE - ISO:C90-6.5.2.2 Enumeration Specifiers | ||||||
An expression which is not of enum type is being used as the return expression in a function which is of enum type. This is permitted in the C language but is it really intended ? It could result in the enum object containing a value which is not a valid member of the enumeration. For example:
/*PRQA S 1277,2006,2017,2201,2203,3198,3227,3408,3447,3448,3602 ++*/
typedef enum tree
{
fir ,
cedar ,
maple ,
pine } TREE;
extern void func1(TREE trp);
extern TREE tra;
extern TREE foo(int mem)
{
func1(mem); /* Message 1441 */
tra = mem; /* Message 1442 */
return(mem); /* Message 1443 */
}
No MISRA C:2012 Rules applicable to message 1443
See also:
![]() | ||
| 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 |