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

hpx/util/safe_lexical_cast.hpp is added. #1270

Merged
merged 4 commits into from Oct 13, 2014

Conversation

AntonBikineev
Copy link
Contributor

Some unprotected uses of boost::lexical_cast are wrapped by safe_lexical_cast. Issue #799.
I tried to use safe_lexical_cast where string casts to number and lexical_cast is not surrounded by try-catch block. Note that some default values should be added.

Some unprotected uses of boost::lexical_cast are wrapped by safe_lexical_cast.
@hkaiser
Copy link
Member

hkaiser commented Sep 22, 2014

Looks good to me

@hkaiser
Copy link
Member

hkaiser commented Sep 22, 2014

Some default values can be derived from the surrounding code, like for instance in this case:

std::string thread_pool_size = 
    ini.get_entry(key + ".io_pool_size", "2"); 
return hpx::util::safe_lexical_cast<std::size_t>(thread_pool_size, 2);

Could you go through the code one more time and change these uses of util::safe_lexical_cast?

@AntonBikineev
Copy link
Contributor Author

Sure.

@sithhell
Copy link
Member

The code uses C++11 uniform initialization. I'm not sure if it's supported
on all our supported compilers.

@hkaiser
Copy link
Member

hkaiser commented Sep 22, 2014

The code uses C++11 uniform initialization. I'm not sure if it's supported
on all our supported compilers.

Good point!

@AntonBikineev: with HPX we currently have to support older compilers not supporting all of C++11. Uniform initialization syntax is unfortunately one of those features not available to us. In your case that should be a simple fix, though, assuming the target type is default constructible.

@AntonBikineev
Copy link
Contributor Author

I'm not sure, but if get_entry_as function does make sense it might be better to move it to more appropriate header.

@hkaiser
Copy link
Member

hkaiser commented Sep 22, 2014

I think it's fine to have it where you put it for now.

hkaiser added a commit that referenced this pull request Oct 13, 2014
hpx/util/safe_lexical_cast.hpp is added.
@hkaiser hkaiser merged commit 2dc9dd3 into STEllAR-GROUP:master Oct 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants