![]() |
![]() |
1020 | ![]() |
||||
![]() | |||||||
| Language extensions | |||||||
The '__typeof__' operator has been used. Message 1020 identifies instances of this language extension. __typeof__ can be used in much the same way as 'sizeof'. Instead of returning a value (the size of an expression or type) it returns a type (the type of the expression or type that is supplied as an operand). __typeof__ is most frequently employed in macros for generating declarations or casts that use the same type as some expression or typename supplied as an argument to the macro. For example:
/*PRQA S 2017,3220,3408,3410,3429,3431,3435,3447,3456,3458 ++*/
#define typeof __typeof__
#define SWAP(a, b) { typeof(a) temp; temp = a; a = b; b = temp; }
extern long x;
extern long y;
extern void foo(void)
{
SWAP(x, y) /* Message 1020 */
}
MISRA C:2012 Rules applicable to message 1020:
| Rule-1.2 (Advisory) | Language extensions should not be used |
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 |