JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc


Identifier Classes

CodeSonar has a number of warning classes concerned with identifier distinctness, uniqueness, and typographical ambiguity.

Distinctness

Two identifiers are considered to be distinct if they differ in significant positions. Significance depends on the identifier type and is user-configurable. By default, CodeSonar will use a significance threshold that depends on the C or C++ version, as shown in the following table.

Identifier Kind Configuration Parameter By Default, First _ Characters Are Significant
C90 C99 C++ otherwise
external name SIGNIFICANCE_LEN_EXTERN 6 31 2047 31
macro SIGNIFICANCE_LEN_MACRO 31 63 2047 31
otherwise SIGNIFICANCE_LEN_OTHER 31 63 2047 31

The warning classes concerned with distinctness are:

Uniqueness

An identifier is considered to be unique if there is no other identifier with the same name.

The warning classes concerned with uniqueness are:

Typographical Ambiguity

Two identifiers are considered to be typographically ambiguous if they differ only in characters that are considered to be typographically similar:

Typographically Ambiguous Characters Description
0 / O numeric zero / capital o
1 / I / l numeric one / capital i / lower case L
2 / Z numeric two / capital z
5 / S numeric five / capital s
8 / B numeric eight / capital b
h / n lower case H / lower case N
rn / m lower case RN / lower case M
a..z / A..Z lower case character / upper case equivalent
strA_strB / strAstrB a string containing an underscore / the equivalent string without the underscore

There is one warning class concerned with typographical ambiguity: Typographically Ambiguous Identifiers.

Relevant Warning Classes

The Typographically Ambiguous Identifiers warning class indicates sets of typographically ambiguous identifiers of any kind.

The following table summarizes the relationships between identifier characteristics and the other identifier-related warning classes.

  external macro non-external, non-macro
external Non-distinct Identifiers: External Names if not distinct. Non-distinct Identifiers: Macro/Other if not distinct (one warning per non-macro identifer). Non-distinct Identifiers: Same Scope if not distinct AND declared at exactly the same scope.

Non-distinct Identifiers: Nested Scope if not distinct AND one declared in subscope of the scope in which the other is declared.

Non-unique Identifiers: Typedef if identical and at least one is a typedef name.

Non-unique Identifiers: Tag if identical and at least one is a tag name.

Non-unique Identifiers: External Name if identical and at least one has external linkage.

Non-unique Identifiers: Internal Name if identical and at least one has internal linkage.

macro Non-distinct Identifiers: Macro/Macro if not distinct. Non-distinct Identifiers: Macro/Other if not distinct (one warning per non-macro identifer)

Non-unique Identifiers: Typedef if not unique and at least one is a typedef name.

Non-unique Identifiers: Tag if not unique and at least one is a tag name.

Non-unique Identifiers: External Name if not unique and at least one has external linkage.

Non-unique Identifiers: Internal Name if not unique and at least one has internal linkage.

non-external, non-macro Non-distinct Identifiers: Same Scope if not distinct AND declared at (exactly) same scope.

Non-distinct Identifiers: Nested Scope if not distinct AND one declared in subscope of the scope in which the other is declared.

Non-unique Identifiers: Typedef if not unique AND at least one is a typedef name.

Non-unique Identifiers: Tag if not unique AND at least one is a tag name.

Non-unique Identifiers: External Name if not unique AND at least one has external linkage.

Non-unique Identifiers: Internal Name if not unique AND at least one has internal linkage.

 

To report problems with this documentation, please visit https://support.codesecure.com/.