Skip to content

Un-deprecate removeMember overloads, return void #693

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

Merged
merged 3 commits into from
Oct 18, 2017
Merged

Un-deprecate removeMember overloads, return void #693

merged 3 commits into from
Oct 18, 2017

Conversation

wolframroesler
Copy link
Contributor

Sometimes we just want to remove something we don't need anymore. Having
to supply a return buffer for the removeMember function to return something
we don't care about is a nuisance. There are removeMember overloads that
don't need a return buffer but they are deprecated. This commit un-deprecates
these overloads and modifies them to return nothing (void) instead of the
object that was removed.

Further discussion: #689

WARNING: Changes the return type of the formerly deprecated removeMember
overloads from Value to void. May break existing client code.

Sometimes we just want to remove something we don't need anymore. Having
to supply a return buffer for the removeMember function to return something
we don't care about is a nuisance. There are removeMember overloads that
don't need a return buffer but they are deprecated. This commit un-deprecates
these overloads and modifies them to return nothing (void) instead of the
object that was removed.

Further discussion: #689

WARNING: Changes the return type of the formerly deprecated removeMember
overloads from Value to void. May break existing client code.
}
Value Value::removeMember(const JSONCPP_STRING& key)
void Value::removeMember(const JSONCPP_STRING& key)
{
return removeMember(key.c_str());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to drop the return here.

Copy link
Contributor Author

@wolframroesler wolframroesler Oct 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning void from a void function works fine, it's just a matter of style. I left the return in to reduce the number of changed lines. Will submit a new commit but don't think that's the reason for the errors we got from the CI builds.

@cdunn2001
Copy link
Contributor

../src/lib_json/json_value.cpp:1205:26: error: return-statement with a value, in function returning 'void' [-fpermissive]

     return nullSingleton();

                          ^

../src/lib_json/json_value.cpp:1209:10: error: return-statement with a value, in function returning 'void' [-fpermissive]

   return removed; // still null if removeMember() did nothing
          ^

Wolfram Rösler and others added 2 commits October 17, 2017 11:37
Don't explicitly return a void value from a void function. Also, convert
size_t to unsigned in the CZString ctor to avoid a compiler warning.
@cdunn2001 cdunn2001 merged commit a06b390 into open-source-parsers:master Oct 18, 2017
orivej added a commit to orivej/jsoncpp that referenced this pull request Nov 26, 2018
hjmjohnson pushed a commit that referenced this pull request Dec 31, 2018
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.

2 participants