From ad483becec8b3620df1543f81fd0c0a5ff1e8fcd Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Fri, 19 Feb 2021 10:53:10 -0600 Subject: [PATCH 1/2] decltype() for loop index iterators My compiler was only complaining about signed/unsigned warnings here, but for maximum forwards compatibility it might be best to insist on using the same data type for the index iterators as is being used for the index range. --- include/openmc/hdf5_interface.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/openmc/hdf5_interface.h b/include/openmc/hdf5_interface.h index ddb2319ae4..88a73415ac 100644 --- a/include/openmc/hdf5_interface.h +++ b/include/openmc/hdf5_interface.h @@ -212,7 +212,7 @@ read_attribute(hid_t obj_id, const char* name, std::vector& vec) // Read char data in attribute read_attr_string(obj_id, name, n, buffer); - for (int i = 0; i < m; ++i) { + for (decltype(m) i = 0; i < m; ++i) { // Determine proper length of string -- strlen doesn't work because // buffer[i] might not have any null characters std::size_t k = 0; @@ -478,7 +478,7 @@ write_dataset(hid_t obj_id, const char* name, // Copy data into contiguous buffer char* temp = new char[n*m]; std::fill(temp, temp + n*m, '\0'); - for (int i = 0; i < n; ++i) { + for (decltype(n) i = 0; i < n; ++i) { std::copy(buffer[i].begin(), buffer[i].end(), temp + i*m); } From b62b843332ce0c49c3362704a0af47b5e33442de Mon Sep 17 00:00:00 2001 From: Roy Stogner Date: Fri, 19 Feb 2021 10:57:16 -0600 Subject: [PATCH 2/2] Fix "unused variable" warning --- include/openmc/surface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/openmc/surface.h b/include/openmc/surface.h index 784ecbcece..5e20576ce0 100644 --- a/include/openmc/surface.h +++ b/include/openmc/surface.h @@ -145,7 +145,7 @@ public: virtual void to_hdf5(hid_t group_id) const = 0; //! Get the BoundingBox for this surface. - virtual BoundingBox bounding_box(bool pos_side) const { return {}; } + virtual BoundingBox bounding_box(bool /*pos_side*/) const { return {}; } }; class CSGSurface : public Surface