From c1fa8595def1ea0b7476822b55ceb03bbe6ecc67 Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Thu, 4 Jul 2024 16:08:36 +0200 Subject: [PATCH] system/ping.cpp: Conditionally use register keyword for backward compatibility; remove for C++17 and later where it is not allowed --- src/system/ping.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/system/ping.cpp b/src/system/ping.cpp index 7b1f87505..912deb937 100644 --- a/src/system/ping.cpp +++ b/src/system/ping.cpp @@ -46,7 +46,11 @@ static int sock = -1; static int in_checksum( u_short *buf, int len ) { - register long sum = 0; +#if __cplusplus < 201703L + register long sum = 0; // Use register for older standards +#else + long sum = 0; // register keyword is not allowed in C++17 and later +#endif u_short answer = 0; while( len > 1 ){