Skip to content

Commit f2ae451

Browse files
committed
Initialize raw pointer data members with nullptr
This uses the __nullptr preprocessor macro which resolves to the correct symbol based on the availability of C++11
1 parent 2c57cab commit f2ae451

File tree

3 files changed

+30
-10
lines changed

3 files changed

+30
-10
lines changed

include/Citation.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
inline std::string citation_message() {
3737
// clang-format off
3838
const char * fmt =
39-
"-----------------------------------------------------------------------\n"
39+
"\n-----------------------------------------------------------------------\n"
4040
" PCMSolver: An Open Source API for the Polarizable Continuum Model\n"
4141
" PCMSolver %s\n\n"
4242
" Git: Branch {%s}, Revision {%s}\n\n"
@@ -45,7 +45,7 @@ inline std::string citation_message() {
4545
" Source repository: https://github.com/PCMSolver/pcmsolver\n"
4646
" Documentation: https://pcmsolver.readthedocs.io/\n"
4747
" PCMSolver initialized on: %s\n"
48-
"-----------------------------------------------------------------------\n\n";
48+
"-----------------------------------------------------------------------\n";
4949
// clang-format on
5050
// Get current time
5151
time_t rawtime;

src/interface/Meddle.cpp

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ pcmsolver_context_t * pcmsolver_new_v1112(pcmsolver_reader_t input_reading,
104104
namespace pcm {
105105
void Meddle::CTORBody() {
106106
// Write PCMSolver output header
107-
infoStream_ << std::endl;
108-
infoStream_ << "~~~~~~~~~~ PCMSolver ~~~~~~~~~~" << std::endl;
107+
infoStream_ << "~~~~~~~~~~ PCMSolver ~~~~~~~~~~\n";
109108
infoStream_ << "Using CODATA " << input_.CODATAyear() << " set of constants."
110109
<< std::endl;
111110
infoStream_ << "Input parsing done " << input_.providedBy() << std::endl;
@@ -126,13 +125,23 @@ void Meddle::CTORBody() {
126125
}
127126

128127
Meddle::Meddle(const Input & input, const HostWriter & write)
129-
: hostWriter_(write), input_(input), hasDynamic_(false) {
128+
: hostWriter_(write),
129+
input_(input),
130+
cavity_(__nullptr),
131+
K_0_(__nullptr),
132+
K_d_(__nullptr),
133+
hasDynamic_(false) {
130134
input_.initMolecule();
131135
CTORBody();
132136
}
133137

134138
Meddle::Meddle(const std::string & inputFileName, const HostWriter & write)
135-
: hostWriter_(write), input_(Input(inputFileName)), hasDynamic_(false) {
139+
: hostWriter_(write),
140+
input_(Input(inputFileName)),
141+
cavity_(__nullptr),
142+
K_0_(__nullptr),
143+
K_d_(__nullptr),
144+
hasDynamic_(false) {
136145
input_.initMolecule();
137146
CTORBody();
138147
}
@@ -143,7 +152,12 @@ Meddle::Meddle(int nr_nuclei,
143152
int symmetry_info[],
144153
const HostWriter & write,
145154
const std::string & inputFileName)
146-
: hostWriter_(write), input_(Input(inputFileName)), hasDynamic_(false) {
155+
: hostWriter_(write),
156+
input_(Input(inputFileName)),
157+
cavity_(__nullptr),
158+
K_0_(__nullptr),
159+
K_d_(__nullptr),
160+
hasDynamic_(false) {
147161
TIMER_ON("Meddle::initInput");
148162
initInput(nr_nuclei, charges, coordinates, symmetry_info);
149163
TIMER_OFF("Meddle::initInput");
@@ -157,7 +171,13 @@ Meddle::Meddle(int nr_nuclei,
157171
int symmetry_info[],
158172
const PCMInput & host_input,
159173
const HostWriter & write)
160-
: hostWriter_(write), input_(Input(host_input)), hasDynamic_(false) {
174+
: hostWriter_(write),
175+
input_(Input(host_input)),
176+
cavity_(__nullptr),
177+
K_0_(__nullptr),
178+
K_d_(__nullptr),
179+
infoStream_("\n~~~~~~~~~~ PCMSolver ~~~~~~~~~~\n"),
180+
hasDynamic_(false) {
161181
TIMER_ON("Meddle::initInput");
162182
initInput(nr_nuclei, charges, coordinates, symmetry_info);
163183
TIMER_OFF("Meddle::initInput");

src/interface/Meddle.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ class PCMSolver_API Meddle __final {
273273
ISolver * K_0_;
274274
/*! Solver with dynamic permittivity */
275275
ISolver * K_d_;
276-
/*! PCMSolver set up information */
277-
mutable std::ostringstream infoStream_;
278276
/*! Whether K_d_ was initialized */
279277
bool hasDynamic_;
278+
/*! PCMSolver set up information */
279+
mutable std::ostringstream infoStream_;
280280
/*! SurfaceFunction map */
281281
mutable SurfaceFunctionMap functions_;
282282
/*! Common implemenation for the CTOR-s */

0 commit comments

Comments
 (0)