[previous] 3651 [next] Using a typedef for an array of unknown size can lead to unexpected results.
Declarations and definitions

The ISO:C Standard does not define if or when a typedef with incomplete array type is actually given a size. This gives rise to implementation-defined behaviour and thereby compromise portability.

For example:


/*PRQA S 2017,2213,3120,3211,3408,3448,3674 ++*/

typedef int ARRAY[];                  /* Message 3650 */

ARRAY x = {1,2};                      /* Message 3651 */

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents