diff --git a/CommandLineArguments.cxx b/CommandLineArguments.cxx
index f2d835c30e04443ccd03aff399198bcbb3803deb..a2ed874c89c2f88c050df9e48eb0fc4f3edfc1db 100644
--- a/CommandLineArguments.cxx
+++ b/CommandLineArguments.cxx
@@ -419,8 +419,7 @@ void CommandLineArguments::SetUnknownArgumentCallback(
 
 const char* CommandLineArguments::GetHelp(const char* arg)
 {
-  CommandLineArguments::Internal::CallbacksMap::iterator it =
-    this->Internals->Callbacks.find(arg);
+  auto it = this->Internals->Callbacks.find(arg);
   if (it == this->Internals->Callbacks.end()) {
     return nullptr;
   }
@@ -429,8 +428,7 @@ const char* CommandLineArguments::GetHelp(const char* arg)
   // one point to if this one is pointing to another argument.
   CommandLineArgumentsCallbackStructure* cs = &(it->second);
   for (;;) {
-    CommandLineArguments::Internal::CallbacksMap::iterator hit =
-      this->Internals->Callbacks.find(cs->Help);
+    auto hit = this->Internals->Callbacks.find(cs->Help);
     if (hit == this->Internals->Callbacks.end()) {
       break;
     }
diff --git a/SystemInformation.cxx b/SystemInformation.cxx
index 54d4621c38d36a4436fe5c278a8835d034e24704..a6f764d5071980de17efdf08a31bd445702548c6 100644
--- a/SystemInformation.cxx
+++ b/SystemInformation.cxx
@@ -3451,7 +3451,7 @@ bool SystemInformationImplementation::RetreiveInformationFromCpuInfoFile()
   // We want to record the total number of cores in this->NumberOfPhysicalCPU
   // (checking only the first proc)
   std::string Cores = this->ExtractValueFromCpuInfoFile(buffer, "cpu cores");
-  unsigned int NumberOfCoresPerSocket = (unsigned int)atoi(Cores.c_str());
+  auto NumberOfCoresPerSocket = (unsigned int)atoi(Cores.c_str());
   NumberOfCoresPerSocket = std::max(NumberOfCoresPerSocket, 1u);
   this->NumberOfPhysicalCPU =
     NumberOfCoresPerSocket * (unsigned int)NumberOfSockets;
diff --git a/SystemTools.cxx b/SystemTools.cxx
index 3ad88f6ceec531edf00f56128e22499ce1778732..3fa174598c176a8368b8e7a7d117a9f61d9a6991 100644
--- a/SystemTools.cxx
+++ b/SystemTools.cxx
@@ -421,7 +421,7 @@ public:
   const envchar* Release(const envchar* env)
   {
     const envchar* old = nullptr;
-    iterator i = this->find(env);
+    auto i = this->find(env);
     if (i != this->end()) {
       old = *i;
       this->erase(i);
@@ -613,8 +613,7 @@ void SystemTools::GetPath(std::vector<std::string>& path, const char* env)
       done = true;
     }
   }
-  for (std::vector<std::string>::iterator i = path.begin() + old_size;
-       i != path.end(); ++i) {
+  for (auto i = path.begin() + old_size; i != path.end(); ++i) {
     SystemTools::ConvertToUnixSlashes(*i);
   }
 }
@@ -3594,7 +3593,7 @@ std::string SystemTools::JoinPath(
   // Construct result in a single string.
   std::string result;
   size_t len = 0;
-  for (std::vector<std::string>::const_iterator i = first; i != last; ++i) {
+  for (auto i = first; i != last; ++i) {
     len += 1 + i->size();
   }
   result.reserve(len);
@@ -3828,7 +3827,7 @@ SystemTools::FileTypeEnum SystemTools::DetectFileType(const char* filename,
 
   // Allocate buffer and read bytes
 
-  unsigned char* buffer = new unsigned char[length];
+  auto* buffer = new unsigned char[length];
   size_t read_length = fread(buffer, 1, length, fp);
   fclose(fp);
   if (read_length == 0) {
diff --git a/testEncoding.cxx b/testEncoding.cxx
index 3ecade8bc41340b83dceba437dc133a2633b8392..089f2f456a92405943f3e4727a7cf9518173d760 100644
--- a/testEncoding.cxx
+++ b/testEncoding.cxx
@@ -140,8 +140,7 @@ static int testWithNulls()
   strings.push_back(std::string("k") + '\0' + '\0');
   strings.push_back(std::string("\0\0\0\0", 4) + "lmn" +
                     std::string("\0\0\0\0", 4));
-  for (std::vector<std::string>::iterator it = strings.begin();
-       it != strings.end(); ++it) {
+  for (auto it = strings.begin(); it != strings.end(); ++it) {
     std::wstring wstr = kwsys::Encoding::ToWide(*it);
     std::string str = kwsys::Encoding::ToNarrow(wstr);
     std::string s(*it);
diff --git a/testSystemTools.cxx b/testSystemTools.cxx
index 6af03d642f29df4520b30ecddd6247b0a6d19af6..670e8dc8bc0e862e914f3bdde9f3f37e62cb9082 100644
--- a/testSystemTools.cxx
+++ b/testSystemTools.cxx
@@ -721,8 +721,7 @@ static std::string StringVectorToString(const std::vector<std::string>& vec)
 {
   std::stringstream ss;
   ss << "vector(";
-  for (std::vector<std::string>::const_iterator i = vec.begin();
-       i != vec.end(); ++i) {
+  for (auto i = vec.begin(); i != vec.end(); ++i) {
     if (i != vec.begin()) {
       ss << ", ";
     }