![]() |
![]() |
1333 | ![]() |
||||
![]() | |||||||
| Functions | |||||||
This function is being called without a previous prototype declaration. However, the number of arguments or the type of the arguments in the function call is different from those specified in the definition of the function encountered later. It is always advisable to use function prototypes consistently throughout your source code. Function prototypes are best located in header files and should always be positioned before any function calls. It can be dangerous to use them in some places but not in others. When functions are called in the absence of a prototype, arguments of type char, short and float are subject to default argument promotion. For example:
/*PRQA S 1302,2017,2110,2114,3199,3203,3227,3408,3447,3602 ++*/
void test(signed char a)
{
int r;
r = foo(a); /* Messages 1333 and 3335 */
}
extern int foo ( unsigned char a ) /* Message 0626 */
{
return (int)a;
}
MISRA-C:2004 Rules applicable to message 1333:
| Rule 8.3 (Required) | For each function parameter the type given in the declaration and definition shall be identical, and the return types shall also be identical. |
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA-C:2004 Compliance Module 3.2 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA-C:2004 Rule Index | Contents |