From 377d2091c1e0f30ef48fb068f672ae624ad59d0f Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Thu, 18 May 2017 18:04:26 +0200 Subject: [PATCH] attempt to get rid of all const_cast (take 2) --- include/xbt/functional.hpp | 3 ++- src/smpi/smpi_global.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/xbt/functional.hpp b/include/xbt/functional.hpp index 2c7c87d231..10c16bf98a 100644 --- a/include/xbt/functional.hpp +++ b/include/xbt/functional.hpp @@ -39,11 +39,12 @@ public: {} void operator()() const { + char noarg[] = {'\0'}; const int argc = args_->size(); std::vector args = *args_; std::unique_ptr argv(new char*[argc + 1]); for (int i = 0; i != argc; ++i) - argv[i] = args[i].empty() ? '\0' : &args[i].front(); + argv[i] = args[i].empty() ? noarg : &args[i].front(); argv[argc] = nullptr; code_(argc, argv.get()); } diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index 63f2a6cdbe..ff2da6f47d 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -489,10 +489,11 @@ typedef void (*smpi_fortran_entry_point_type)(); static int smpi_run_entry_point(smpi_entry_point_type entry_point, std::vector args) { + char noarg[] = {'\0'}; const int argc = args.size(); std::unique_ptr argv(new char*[argc + 1]); for (int i = 0; i != argc; ++i) - argv[i] = args[i].empty() ? '\0' : &args[i].front(); + argv[i] = args[i].empty() ? noarg : &args[i].front(); argv[argc] = nullptr; int res = entry_point(argc, argv.get()); -- 2.20.1