Change member variable from 'is' to 'is_' to avoid possible (macro) name collision #4406
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TL; DR: This pull request was attempting to addresses potential naming collisions with macros defined by users of the library. Specifically, the member variable
is
in theinput_adapter
class has been renamed tois_
andsb
tosb_
.Description
we encountered issues caused by some users who came from Java/C# and defined
is
as a macro in their code. This macro interfered with the library internal implementation, resulting in unexpected behavior and compilation errors due to the macro replacing variables namedis
in the library's internal implementation.I admit defining
is
is very inappropriate and was a bad idea and inadvisable for them. It's the user's fault to do that and definitely out of control of this json library, however, I believe that issues caused by suchkeyword-like
named variables are avoidable. To prevent potential naming collisions and improve compatibility with user-defined macros, in theinput_adapter
class, Iis
tois_
.sb
tosb_
(naming consistency).Pull request checklist
include/nlohmann
directory, runmake amalgamate
to create the single-header filessingle_include/nlohmann/json.hpp
andsingle_include/nlohmann/json_fwd.hpp
. The whole process is described here.