Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add const char* entry to ADIOS constructors to avoid ugliness #2761

Merged
merged 1 commit into from
Jun 15, 2021

Conversation

eisenhauer
Copy link
Member

As reported by @khuck , the ADIOS2 C++ API has some unexpected behaviour. In particular, constructors like this:
adios2::ADIOS adios("config.xml");
Do not match with this constructor:
ADIOS(const std::string &configFile, const bool debugMode = true);
Instead, they match with this constructor:
ADIOS(const bool debugMode = true);

Because C++ (at least some compilers) would preferentially convert the "const char*" to "bool", resulting in a config file specification that is silently ignored. For more info see:
https://www.bfilipek.com/2019/07/surprising-conversions-char-bool.html

This PR adds a new entry to the C++ API:
ADIOS(const char *configFile);

And adds a test to make sure that the simple ADIOS("configfile.xml") specification results in an attempt to parse that file, not the specification being ignored. We might want to further examine the ADIOS API for similar instances.

@eisenhauer eisenhauer requested a review from pnorbert June 11, 2021 14:01
@eisenhauer eisenhauer merged commit 4056265 into ornladios:master Jun 15, 2021
@eisenhauer eisenhauer deleted the ConfigAPI branch June 15, 2021 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant