open-source-parsers / open-source-parsers/jsoncpp
Make Value( bool value ) etc explicit
Open
Nobody has claimed this yet.
duplicate
enhancement
Language Conformance
- Dominant language
- C++
- Stars
- 8.9k
- Forks
- 2.7k
- Avg merge
- 31m
- Merged PRs (30d)
- 1
Description
when passing a Json::Value pointer to a const Json::Value &;
compiler will automatically transform the pointer to bool then to a json::value;
void LogJson(const Json::Value& value) {
LOG(ERROR) << value.toStyledString();
}
int main() {
Json::Value json = Json::Value(Json::objectValue)
const Json::Value *json_p = &json;
LogJson(json);
LogJson(json_p);
}
the first LogJson will log a "{}"
the second LogJson will log a "true", caused by implict conversation
Expecte the second LogJson will compile fail.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Json::Value constructors and conversion behavior demonstrated by the LogJson example. Reproduce both calls with the shown snippet, then verify that passing a Json::Value pointer no longer compiles while passing a Json::Value object still does.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100