[previous] 3448 [next] Declaration of typedef '%s' is not in a header file although it is used in a definition or declaration with external linkage.
Declarations and Definitions

It makes sense not to define a typedef in more than one place. If the typedef is used to declare or define an object or function with external linkage, it should be defined in a header file because it can be assumed that the typedef will be required in more than one translation unit. This practice is safer and more maintainable than inserting a local declaration in each source file.

Be aware that QA·C only recognises a file as being a header file when it is analysed via a #include statement. So, for example, message 3448 will be generated in a ".h" file if the typedef is used in a declaration with external linkage and the file is analysed on its own.

For example:


/*PRQA S 2017 ++*/

typedef int TYPE;         /* Message 3448 */
extern TYPE foo(void);    /* Message 3447 */

extern TYPE foo(void)
{
    return 1;
}

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