[metadata]
id = "STR04-C"
type = "recommendation"
category = "STR"
number = 4
title = "Use plain char for characters in the basic character set"
description = """
There are threecharacter types:char,signed char, andunsigned char. Compilers
have the latitude to definecharto have the same range, representation, and
behavior as eithersigned charorunsigned char. Irrespective of the choice
made,charis a separate type from the other two and is not compatible with
either. For characters in the basic character set, it does not matter which data
type is used, except for type compatibility. Consequently, it is best to use
plaincharfor character data for compatibility with standard string-handling
functions. In most cases, the only portable operators on plainchartypes are
assignment and equality operators (=,==,!=). An exception is the translation to
and from digits. For example, if thecharcis a digit,c - '0'is a value between 0
and 9.
"""
severity = "Low"
likelihood = "Unlikely"
priority = "P2"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "May 20, 2025"
[rules.cert_c.STR04-C]
enabled = true
[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/STR04-C.+Use+plain+char+for+characters+in+the+basic+character+set"