• Home
  • Raw
  • Download

Lines Matching +full:unused +full:- +full:variable

1 .. _docs-embedded-cpp:
21 expression, such as a template parameter, constexpr variable initialization, or
28 likely to inline it than other functions. Marking non-trivial functions as
35 constexpr-constructible unless it actually needs to be used in a constant
41 can be used in any constant expression, such as a non-type template argument,
42 ``static_assert`` statement, or another constexpr variable initialization.
47 the ``const`` qualifier when declaring a constexpr variable.
52 .. code-block:: cpp
68 .. code-block:: cpp
81 The above code works seamlessly with values of any type -- float, int, or even a
90 Be careful when instantiating non-trivial template functions with multiple
100 can prevent linker garbage collection, resulting in unused functions being
120 * ``-Wall`` and ``-Wextra`` -- Standard sets of compilation warnings, which
122 * ``-Wimplicit-fallthrough`` -- Requires explicit ``[[fallthrough]]``
125 * ``-Wundef`` -- Requires macros to be defined before using them. This
129 Unused variable and function warnings
130 -------------------------------------
131 The ``-Wall`` and ``-Wextra`` flags enable warnings about unused variables or
133 unused items. In some circumstances, these cannot be removed, so the warning
136 1. When possible, delete unused variables, functions, or class definitions.
137 2. If an unused entity must remain in the code, avoid giving it a name. A
138 common situation that triggers unused parameter warnings is implementing a
140 If desired, the variable name can remain in the code as a comment.
142 .. code-block:: cpp
155 3. In C++, annotate unused entities with `[[maybe_unused]]
159 .. code-block:: cpp
161 // This variable is unused in certain circumstances.
169 4. As a final option, cast unused variables to ``void`` to silence these
173 In C, silencing warnings on unused functions may require compiler-specific
174 attributes (``__attribute__((unused))``). Avoid this by removing the
178 ----------------------------------------
184 .. code-block:: cpp