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
\page qmllint-warnings-and-errors-unreachable-code.html
6
\ingroup qmllint-warnings-and-errors
7
8
\title Unreachable code
9
\brief [unreachable-code] Some instructions are unreachable.
10
11
\qmllintwarningcategory unreachable-code
12
13
\section1 Unreachable code
14
15
\section2 What happened?
16
Instructions in your code are unreachable and will never be executed.
17
18
\section2 Why is that bad?
19
Unreachable code does not contribute to the program logic and bloats the disk
20
and memory footprint of the application. Unreachable code can be a sign of
21
underlying bugs or logic errors.
22
23
\section2 Example
24
\qml
25
function f(b: bool) : string {
26
if (b)
27
return "true"
28
else
29
return "false"
30
return "something else??" // unreachable statement
31
}
32
\endqml
33
To fix this warning, remove the dead instructions or refactor your code to make
34
all logic reachable.
35
\qml
36
function f(b: bool) : string {
37
if (b)
38
return "true"
39
else
40
return "false"
41
}
42
\endqml
43
*/
qtdeclarative
src
qml
doc
src
qmllint
unreachable-code.qdoc
Generated on
for Qt by
1.16.1