[previous] 1022 [next] [E] '__alignof__' is not supported in ISO C, and is treated as a language extension.
Language extensions

The '__alignof__' operator has been used. Message 1022 identifies instances of this language extension.

__alignof__ can be used in much the same way as 'sizeof'. Instead of returning a size, it returns a value which represents the alignment requirement of the operand (in bytes). As with 'sizeof', the operand may be either an expression or an explicit type.

In the context of QAC, __alignof__ will return the alignment value as determined from the configuration option -align.

For example:


/*PRQA S 1257,2017,3198,3199,3203,3408 ++*/

extern void foo(void)
{
  int test;

  test = __alignof__(char);   /* Message 1022 */

  test = __alignof__(test);   /* Message 1022 */
}


MISRA-C:2004 Rules applicable to message 1022:

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