[metadata]
id = "DCL13-C"
type = "recommendation"
category = "DCL"
number = 13
title = "Declare function parameters that are pointers to values not changed by the function as const"
description = """
Declaring function parametersconstindicates that the function promises not to
change these values. In C, function arguments are passed by value rather than by
reference. Although a function may change the values passed in, these changed
values are discarded once the function returns. For this reason, many
programmers assume a function will not change its arguments and that declaring
the function's parameters asconstis unnecessary. void foo(int x) { x = 3; /*
Visible only in the function */ /* ... */ }
"""
severity = "Low"
likelihood = "Unlikely"
priority = "P3"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "Jul 02, 2025"
[rules.cert_c.DCL13-C]
enabled = true
[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/DCL13-C.+Declare+function+parameters+that+are+pointers+to+values+not+changed+by+the+function+as+const"