From 2c3e860a04864e21b72d13b13a62aeba220033cc Mon Sep 17 00:00:00 2001 From: Thilo Graf Date: Mon, 2 Sep 2024 21:06:01 +0200 Subject: [PATCH] system/ping.cpp: Conditionally use register keyword for backward compatibility; remove for C++17 and later where it is not allowed Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/ef0d29f448c3bf97521d4718c566ac1f794f7a91 Author: Thilo Graf Date: 2024-09-02 (Mon, 02 Sep 2024) ------------------ This commit was generated by Migit --- 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 ){