summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRym Bouabid <rym.bouabid@qt.io>2023-09-11 14:14:13 +0200
committerRym Bouabid <rym.bouabid@qt.io>2023-09-13 20:45:17 +0200
commitc4a1c171a3b2ade21a344de99962b3848e4ad85a (patch)
tree0eb4f6dad43e1cceb33bed4eacfe05bcf4592811
parent2a2275756b31ae870b5735aecb21a6e8f4c6bd55 (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 Pick-to: 6.6 6.5 Change-Id: I4abf5162d521fc5dca0286a6254f86c57a473367 Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
-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);