system/ping.cpp: Conditionally use register keyword for backward compatibility;

remove for C++17 and later where it is not allowed
This commit is contained in:
2024-07-04 16:08:36 +02:00
parent b0bd45c12b
commit c1fa8595de

View File

@@ -46,7 +46,11 @@ static int sock = -1;
static int static int
in_checksum( u_short *buf, int len ) 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; u_short answer = 0;
while( len > 1 ){ while( len > 1 ){