Skip to content

Revert "Use std namespace for snprintf." #231

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

Closed

Conversation

baruchsiach
Copy link
Contributor

This reverts commit 1c58876.

std::snprintf() is only available in C++11, which is not provided by
all compilers. Since the C library snprintf() can easily be used as a
replacement on Linux systems, this patch changes jsoncpp to use the C
library snprintf() instead of C++11 std::snprintf(), fixing the build error
below:

src/lib_json/json_writer.cpp:33:18: error: 'snprintf' is not a member of 'std'

This reverts commit 1c58876.

std::snprintf() is only available in C++11, which is not provided by
all compilers. Since the C library snprintf() can easily be used as a
replacement on Linux systems, this patch changes jsoncpp to use the C
library snprintf() instead of C++11 std::snprintf(), fixing the build error
below:

src/lib_json/json_writer.cpp:33:18: error: 'snprintf' is not a member of 'std'
@BillyGoto
Copy link

Careful! The C function in the global namespace is not guaranteed to
be provided by . If you want the C function you must include
<stdio.h>, and if you use you are only guaranteed to get
std::snprintf.

On Tuesday, March 31, 2015, Baruch Siach notifications@github.com wrote:

This reverts commit 1c58876
1c58876
.

std::snprintf() is only available in C++11, which is not provided by
all compilers. Since the C library snprintf() can easily be used as a
replacement on Linux systems, this patch changes jsoncpp to use the C
library snprintf() instead of C++11 std::snprintf(), fixing the build error
below:

src/lib_json/json_writer.cpp:33:18: error: 'snprintf' is not a member of

'std'

You can view, comment on, or merge this pull request online at:

#231
Commit Summary

  • Revert "Use std namespace for snprintf."

File Changes

Patch Links:


Reply to this email directly or view it on GitHub
#231.

ǝnɥɐuop ʎllıq

cdunn2001 pushed a commit to cdunn2001/jsoncpp that referenced this pull request Mar 31, 2015
This reverts commit 1c58876.

std::snprintf() is only available in C++11, which is not provided by
all compilers. Since the C library snprintf() can easily be used as a
replacement on Linux systems, this patch changes jsoncpp to use the C
library snprintf() instead of C++11 std::snprintf(), fixing the build error
below:

    src/lib_json/json_writer.cpp:33:18: error: 'snprintf' is not a member of 'std'

See open-source-parsers#231, open-source-parsers#224, and open-source-parsers#218.
This was referenced Mar 31, 2015
@cdunn2001
Copy link
Contributor

I included your commit in #232, plus something to address Billy's caveat. See #224 for more discussion.

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.

3 participants