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
confusing-expression-statement.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-confusing-expression-statement.html
6
\ingroup qmllint-warnings-and-errors
7
8
\title Confusing expression statement
9
\brief [confusing-expression-statement] Confusing expression statements.
10
11
\qmllintwarningcategory confusing-expression-statement
12
13
\section1 Expression statement has no obvious effect
14
15
\section2 What happened?
16
You used an expression statement that has no obvious effect.
17
18
\section2 Why is that bad?
19
It makes the code more difficult to read and may cause confusion. Usually,
20
it indicates that some expression result was ignored.
21
22
The expression statement is compiled into bytecode and evaluated at runtime,
23
despite not having any effect.
24
25
\section2 Example
26
\qml
27
import QtQuick
28
29
Item {
30
function add(a: int, b: int) : int {
31
a + b
32
}
33
}
34
\endqml
35
To fix this warning, remove the expression without effect or use the
36
expression result.
37
38
\qml
39
import QtQuick
40
41
Item {
42
function add(a: int, b: int) : int {
43
return a + b
44
}
45
}
46
\endqml
47
*/
qtdeclarative
src
qml
doc
src
qmllint
confusing-expression-statement.qdoc
Generated on
for Qt by
1.16.1