Universal character name from token concatenation
You create a universal character name by joining tokens with
##
operator
Description
This defect
occurs when two preprocessing tokens joined with a ##
operator create
a universal character name. A universal character name begins with \u
or \U
followed by hexadecimal digits. It represents a character not
found in the basic character set.
For instance, you form the character \u0401
by joining two
tokens:
#define assign(uc1, uc2, val) uc1##uc2 = val ... assign(\u04, 01, 4);
Risk
The C11 Standard (Sec. 5.1.1.2) states that if a universal character name is formed by token concatenation, the behavior is undefined.
Fix
Use the universal character name directly instead of producing it through token concatenation.
Examples
Result Information
Group: Programming |
Language: C | C++ |
Default: On for handwritten code, off for generated code |
Command-Line Syntax:
PRE_UCNAME_JOIN_TOKENS |
Impact: Low |
Version History
Introduced in R2018a
See Also
MISRA C:2012 Rule 20.10
| Find defects (-checkers)
Topics
- Interpret Bug Finder Results in Polyspace Desktop User Interface
- Interpret Bug Finder Results in Polyspace Access Web Interface (Polyspace Access)
- Address Results in Polyspace User Interface Through Bug Fixes or Justifications
- Address Results in Polyspace Access Through Bug Fixes or Justifications (Polyspace Access)