[previous] 1024 [next] [C] Using '__alignof__' on incomplete types is illegal.
Constraint violations

This is a constraint error

The operand of the __alignof__ operator cannot be of incomplete type.

'__alignof__' is not part of the standard C language. It is supported by the GCC compiler as an operator that returns the alignment requirements in bytes of its operand.

For example:


/*PRQA S 1022,1257,2017,3199,3203,3408,3447,3625,3684 ++*/

extern char buf[];

extern void foo(void)
{
  int a;

  a = __alignof__(buf);         /* Message 1024 */
}


MISRA C:2012 Rules applicable to message 1024:

Rule-1.1  (Required) The program shall contain no violations of the standard C syntax and constraints, and shall not exceed the implementation's translation limits


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