![]() |
![]() |
0313 | ![]() |
||||
![]() | |||||||
| Pointers | REFERENCE - ISO:C90-6.3.4 Cast Operators - Semantics | ||||||
An expression of type 'pointer-to-function' is being cast to a different 'pointer-to-function' type. According to ISO:C90, the only circumstances under which a function pointer can legitimately be converted to a different function pointer type are as follows:
/*PRQA S 0428,2017,2211,3198,3199,3203,3408,3447,3635,3672 ++*/
extern void error( long * x );
extern void foo(void)
{
void (* pf)( int * x );
unsigned long ulx;
pf = (void (*)( int * x)) error; /* Message 0313 */
ulx = (unsigned long)&error; /* Message 0305 */
pf = (void (*)( int * x)) ulx; /* Message 0305 */
}
MISRA C:2012 Rules applicable to message 0313:
| Rule-11.1 (Required) | Conversions shall not be performed between a pointer to a function and any other type |
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 |