summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRym Bouabid <rym.bouabid@qt.io>2023-09-11 14:14:13 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-09-14 20:13:37 +0000
commitacf7871558b9f47d943e346a84f2e1542c50a76c (patch)
tree768d67e98aefb15187a37051bbf810bfcdd6c3f1
parentc58b9f591939e290858b9e3bc071763ed6ea6434 (diff)
Revamp Semaphores example: Replace const by constexpr when applicable
Replace const by constexpr when the value of the variable can be calculated at compile-time. Fixes: QTBUG-108859 Change-Id: I4abf5162d521fc5dca0286a6254f86c57a473367 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io> (cherry picked from commit c4a1c171a3b2ade21a344de99962b3848e4ad85a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> (cherry picked from commit 87728a233062eb6a9039676479cf534e20ca3526)
-rw-r--r--examples/corelib/threads/semaphores/semaphores.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/examples/corelib/threads/semaphores/semaphores.cpp b/examples/corelib/threads/semaphores/semaphores.cpp
index 5a49555110..103f331b0c 100644
--- a/examples/corelib/threads/semaphores/semaphores.cpp
+++ b/examples/corelib/threads/semaphores/semaphores.cpp
@@ -7,9 +7,9 @@
#include <stdlib.h>
//! [0]
-const int DataSize = 100000;
+constexpr int DataSize = 100000;
-const int BufferSize = 8192;
+constexpr int BufferSize = 8192;
char buffer[BufferSize];
QSemaphore freeBytes(BufferSize);