[AGENT++] src/asn1.cpp:386:5: error: ISO C++17 does not allow 'register' storage class specifier

Claus Klein claus.klein at arcormail.de
Thu Aug 23 09:29:36 CEST 2018


> Am 22.08.2018 um 08:45 schrieb Claus Klein <claus.klein at arcormail.de>:
> 
> C++17 is the current standard, I think, it should be supported too!

By the way:

This means, there is no delete for this new!

|| Checking consoleExamples/snmpInform.cpp ...
|| Checking consoleExamples/snmpInform.cpp: DEFAULT_LOG_PROFILE=original;HAVE_LOCALTIME_R=1;HAVE_GETHOSTBYNAME_R=1;POSIX_THREADS=1;_SNMPv3=1;SNMP_PP_IPv6=1;HAVE_LIBSSL=1...
consoleExamples/snmpInform.cpp|364| warning: Variable 'v3_MP' is assigned a value that is never used. [unreadVariable]
||         v3_MP = new v3MP("dummy", 0, construct_status);
|| ^

it may be prevented by:
diff --git a/consoleExamples/snmpInform.cpp b/consoleExamples/snmpInform.cpp
index 7b85799..1520c23 100644
--- a/consoleExamples/snmpInform.cpp
+++ b/consoleExamples/snmpInform.cpp
@@ -166,7 +166,6 @@ int main(int argc, char** argv)
     OctetStr contextEngineID("");
     long authProtocol = SNMP_AUTHPROTOCOL_NONE;
     long privProtocol = SNMP_PRIVPROTOCOL_NONE;
-    v3MP* v3_MP;
 #endif
 
     char* ptr;
@@ -348,7 +347,7 @@ int main(int argc, char** argv)
         }
 
         int construct_status;
-        v3_MP = new v3MP(engineId, snmpEngineBoots, construct_status);
+        std::unique_ptr<v3MP> v3_MP ( new v3MP(engineId, snmpEngineBoots, construct_status));
         if (construct_status != SNMPv3_MP_OK) {
             std::cout << "Error initializing v3MP: " << construct_status
                       << std::endl;
@@ -361,7 +360,7 @@ int main(int argc, char** argv)
     } else {
         // MUST create a dummy v3MP object if _SNMPv3 is enabled!
         int construct_status;
-        v3_MP = new v3MP("dummy", 0, construct_status);
+        std::unique_ptr<v3MP> v3_MP ( new v3MP("dummy", 0, construct_status));
     }
 #endif
 



More information about the AGENTPP mailing list