Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
src_corelib_tools_qscopeguard.cpp
Go to the documentation of this file.
1
// Copyright (C) 2018 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Sérgio Martins <sergio.martins@kdab.com>
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
5
void
myComplexCodeWithMultipleReturnPoints
(
int
v
)
6
{
7
// The lambda will be executed right before your function returns
8
auto
cleanup =
qScopeGuard
([] { code you want executed goes HERE; });
9
10
if
(
v
== -1)
11
return
;
12
13
int
v2
= code_that_might_throw_exceptions();
14
15
if
(
v2
== -1)
16
return
;
17
18
(...)
19
}
v2
GLint GLfloat GLfloat GLfloat v2
Definition
qopengles2ext.h:1822
v
GLsizei const GLfloat * v
[13]
Definition
qopengles2ext.h:788
qScopeGuard
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
Definition
qscopeguard.h:60
myComplexCodeWithMultipleReturnPoints
void myComplexCodeWithMultipleReturnPoints(int v)
[0]
Definition
src_corelib_tools_qscopeguard.cpp:5
qtbase
src
corelib
doc
snippets
code
src_corelib_tools_qscopeguard.cpp
Generated by
1.10.0