![]() |
![]() |
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:2004 Rules applicable to message 1020:
| Rule 1.1 (Required) | All code shall conform to ISO/IEC 9899:1990 C programming language, ISO 9899, amended and corrected by ISO/IEC 9899/COR1:1995, ISO/IEC 9899/AMD1:1995, and ISO/IEC 9899/COR2: 1996192 |
See also:
![]() | ||
| 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 |