Skip to content

Commit 3f65436

Browse files
committed
Remove use of enum for constants
This was a useful trick back in the days, but in C++17 it is not needed any more. The constexpr expression is more clear in its intent. See for instance here: https://stackoverflow.com/questions/37259807/static-constexpr-int-vs-old-fashioned-enum-when-and-why
1 parent 48176a1 commit 3f65436

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/export/export_format_pg.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
3232

3333
#include <string>
3434

35-
enum {
36-
initial_buffer_size = 1024U * 1024U
37-
};
38-
39-
enum {
40-
flush_buffer_size = 800U * 1024U
41-
};
35+
static constexpr std::size_t initial_buffer_size = 1024UL * 1024UL;
36+
static constexpr std::size_t flush_buffer_size = 800UL * 1024UL;
4237

4338
ExportFormatPg::ExportFormatPg(const std::string& /*output_format*/,
4439
const std::string& output_filename,

0 commit comments

Comments
 (0)