Mismatch between typedef statements
This checker is deactivated in a default Polyspace® as You Code analysis. See Checkers Deactivated in Polyspace as You Code Default Analysis (Polyspace Bug Finder Access).
This defect occurs when typedef statements lead to conflicting underlying
types for one of these data types:
size_t
ssize_t
wchar_t
ptrdiff_t
If you change the underlying type of size_t, ssize_t, wchar_t,
or ptrdiff_t, you have inconsistent definitions
of the same type. Compilation units with different include paths can
potentially use different-sized types causing conflicts in your program.
For example, say that you define a function in one compilation
unit that redefines size_t as unsigned long. But
in another compilation unit that uses the size_t definition
from <stddef.h>, you use the same function
as an extern declaration. Your program will encounter
a mismatch between the function declaration and function definition.
Use consistent type definitions. For example:
Remove custom type definitions for these fundamental types. Only use system definitions.
Use the same size for all
compilation units. Move your typedef to a shared
header file.
| Group: Programming |
| Language: C | C++ |
| Default: On |
Command-Line Syntax: TYPEDEF_MISMATCH |
| Impact: High |