Page MenuHomePhabricator

Make objects in range declarations immutable by default. Avoid unnecessary copying of objects in range declarations.
AbandonedPublic

Authored by fpelliccioni on Oct 1 2019, 16:32.

Details

Reviewers
Fabien
deadalnix
Group Reviewers
Restricted Project
Summary

Make objects in range declarations immutable by default.

Backport of Bitcoin Core PR13249
https://github.com/bitcoin/bitcoin/pull/13249

Test Plan
make check-all

Diff Detail

Repository
rABC Bitcoin ABC
Branch
feature-backport-5c24d3b98
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 7702
Build 13443: Bitcoin ABC Buildbot (legacy)
Build 13442: arc lint + arc unit

Event Timeline

deadalnix requested changes to this revision.Oct 1 2019, 18:46

Part of the PR are missing.

This revision now requires changes to proceed.Oct 1 2019, 18:46

Part of the PR are missing.

It is a partial application of the PR, I forgot to clarify it, sorry. (summary edited).
I didn't apply the rule for built-in types, because it makes no sense:
for (int x : seq)
is preferred over
for (int const& x : seq).
Have I missed anything else?

update the summary to clarify that it is a partial application of the PR.

deadalnix requested changes to this revision.Oct 3 2019, 15:41

Part of the PR are missing.

It is a partial application of the PR, I forgot to clarify it, sorry. (summary edited).
I didn't apply the rule for built-in types, because it makes no sense:
for (int x : seq)
is preferred over
for (int const& x : seq).
Have I missed anything else?

for (const int x : seq) is even better. There are still some missing, for instance in qt/bitcoingui.cpp .

This revision now requires changes to proceed.Oct 3 2019, 15:41

Part of the PR are missing.

It is a partial application of the PR, I forgot to clarify it, sorry. (summary edited).
I didn't apply the rule for built-in types, because it makes no sense:
for (int x : seq)
is preferred over
for (int const& x : seq).
Have I missed anything else?

for (const int x : seq) is even better. There are still some missing, for instance in qt/bitcoingui.cpp .

I disagree, const is no needed in this case, but... you are the boss ;P

east_const_wrist-e1522954757593.jpeg (300×225 px, 15 KB)

Applying const T x : seq where T is a built-in type.

Was superseded by D4221.

An error occurred using arc and` git` that I could not solve.
I had help from Fabien.