Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
unreachable-code.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2026 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\ingroup qmllint-warnings-and-errors
6
7
\title Unreachable code
8
\brief [unreachable-code] Some instructions are unreachable.
9
10
\qmllintwarningcategory unreachable-code
11
12
\section1 Unreachable code
13
14
\section2 What happened?
15
Instructions in your code are unreachable and will never be executed.
16
17
\section2 Why is that bad?
18
Unreachable code does not contribute to the program logic and bloats the disk
19
and memory footprint of the application. Unreachable code can be a sign of
20
underlying bugs or logic errors.
21
22
\section2 Example
23
\qml
24
function f(b: bool) : string {
25
if (b)
26
return "true"
27
else
28
return "false"
29
return "something else??" // unreachable statement
30
}
31
\endqml
32
To fix this warning, remove the dead instructions or refactor your code to make
33
all logic reachable.
34
\qml
35
function f(b: bool) : string {
36
if (b)
37
return "true"
38
else
39
return "false"
40
}
41
\endqml
42
*/
qtdeclarative
src
qml
doc
src
qmllint
unreachable-code.qdoc
Generated on
for Qt by
1.16.1