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 OK
Unit
No Unit Test Coverage
Build Status
Buildable 7649
Build 13337: Bitcoin ABC Buildbot (legacy)

Event Timeline

fpelliccioni created this revision.Oct 1 2019, 16:32
Herald added a reviewer: Restricted Project. · View Herald TranscriptOct 1 2019, 16:32
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?

fpelliccioni edited the summary of this revision. (Show Details)Oct 3 2019, 13:19
fpelliccioni updated this revision to Diff 13335.Oct 3 2019, 13:24

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
fpelliccioni added a comment.EditedOct 4 2019, 20:27

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

fpelliccioni updated this revision to Diff 13377.Oct 7 2019, 14:23

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

fpelliccioni edited the summary of this revision. (Show Details)Oct 7 2019, 14:24
fpelliccioni abandoned this revision.Oct 7 2019, 17:50

Was superseded by D4221.

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