Just use a default-member-initializer to zero-initialize the array
member, instead of using std::fill.

libgcobol/ChangeLog:

        * exceptl.h (cbl_declarative_t): Simplify array
        initialization.
---
 libgcobol/exceptl.h | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/libgcobol/exceptl.h b/libgcobol/exceptl.h
index 35809034f4f..dedf5520e43 100644
--- a/libgcobol/exceptl.h
+++ b/libgcobol/exceptl.h
@@ -130,22 +130,19 @@ struct cbl_declarative_t {
   size_t section; // implies program
   bool global;
   ec_type_t type;
-  uint32_t nfile, files[files_max];
+  uint32_t nfile = 0;
+  uint32_t files[files_max] = {};
   cbl_file_mode_t mode;
 
   cbl_declarative_t( cbl_file_mode_t mode = file_mode_none_e )
     : section(0), global(false), type(ec_none_e)
-    , nfile(0)
     , mode(mode)
   {
-    std::fill(files, files + COUNT_OF(files), 0);
   }
   cbl_declarative_t( ec_type_t type )
     : section(0), global(false), type(type)
-    , nfile(0)
     , mode(file_mode_none_e)
   {
-    std::fill(files, files + COUNT_OF(files), 0);
   }
 
   cbl_declarative_t( size_t section, ec_type_t type,
@@ -156,7 +153,6 @@ struct cbl_declarative_t {
     , mode(mode)
   {
     assert( files.size() <= COUNT_OF(this->files) );
-    std::fill(this->files, this->files + COUNT_OF(this->files), 0);
     if( nfile > 0 ) {
       std::copy( files.begin(), files.end(), this->files );
     }
@@ -166,7 +162,6 @@ struct cbl_declarative_t {
     , nfile(that.nfile)
     , mode(that.mode)
   {
-    std::fill(files, files + COUNT_OF(files), 0);
     if( nfile > 0 ) {
       std::copy( that.files, that.files + nfile, this->files );
     }
-- 
2.48.1

Reply via email to