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

C++11 std::to_string is not supported on Windows GCC #76

Open
abelhegedus opened this issue Sep 30, 2015 · 2 comments
Open

C++11 std::to_string is not supported on Windows GCC #76

abelhegedus opened this issue Sep 30, 2015 · 2 comments

Comments

@abelhegedus
Copy link
Member

The rALF language includes three toString() methods for Integer, Real and Boolean.

In C++11, std::to_string() was introduced for several types (though not for bool), however, for some obscure reason (_GLIBCXX_HAVE_BROKEN_VSWPRINTF), the gcc available in Cygwin and MinGW does not support this function:

Since we would like to support compilation on Windows, we will create our own implementation in the xumlrt C++ runtime, however, we wanted to raise the issue here as well. Maybe you have some suggestions or know-how worth sharing.

@doczir
Copy link
Contributor

doczir commented Sep 30, 2015

The easiest implementation could be using stringstream. Example:

template <typename T>
::std::string to_string(T value) {
    ::std::stringstream ss;
    ss << value;
    return ss.str();
}

If support for boolean is required, a specialized template method can solve that:

template <>
::std::string to_string<bool>(bool value)
{
    if (value)
        return "true";
    return "false";
}

@abelhegedus
Copy link
Member Author

Yes, that is the workaround that we adopted. This issue is more about Windows - Linux GCC differences and the desired approach in tackling such issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants