{"action":"created","issue":{"url":"https://api.github.com/repos/tux3/qTox/issues/3411","repository_url":"https://api.github.com/repos/tux3/qTox","labels_url":"https://api.github.com/repos/tux3/qTox/issues/3411/labels{/name}","comments_url":"https://api.github.com/repos/tux3/qTox/issues/3411/comments","events_url":"https://api.github.com/repos/tux3/qTox/issues/3411/events","html_url":"https://github.com/tux3/qTox/pull/3411","id":161008150,"number":3411,"title":"fix(persistence): pass by reference to const","user":{"login":"PafXUS","id":19802901,"avatar_url":"https://avatars.githubusercontent.com/u/19802901?v=3","gravatar_id":"","url":"https://api.github.com/users/PafXUS","html_url":"https://github.com/PafXUS","followers_url":"https://api.github.com/users/PafXUS/followers","following_url":"https://api.github.com/users/PafXUS/following{/other_user}","gists_url":"https://api.github.com/users/PafXUS/gists{/gist_id}","starred_url":"https://api.github.com/users/PafXUS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PafXUS/subscriptions","organizations_url":"https://api.github.com/users/PafXUS/orgs","repos_url":"https://api.github.com/users/PafXUS/repos","events_url":"https://api.github.com/users/PafXUS/events{/privacy}","received_events_url":"https://api.github.com/users/PafXUS/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-06-18T05:33:24Z","updated_at":"2016-06-19T10:44:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tux3/qTox/pulls/3411","html_url":"https://github.com/tux3/qTox/pull/3411","diff_url":"https://github.com/tux3/qTox/pull/3411.diff","patch_url":"https://github.com/tux3/qTox/pull/3411.patch"},"body":"This commit changes passing by value behavior for password occurrences to pass by reference to const.\r\nI've noticed great inconsistency in codebase about how \"in\" parameters of large (with sizeof(T) > 8 bytes) non-trivial types are passed around. For example QString, QByteArray, QList, std::function, IPCEventHandler, ToxFile sometimes are passed around by value, sometimes, by reference to const. I think all of them should be passed by reference to const by default. This advice can be found in [CoreGuidelines](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#f16-for-in-parameters-pass-cheaply-copied-types-by-value-and-others-by-reference-to-const). This must be applied to Qt types with implicit sharing as well (you can see how Qt library itself pass it's types). Exceptions to this can be intentional moving around types, [copy-and-swap idiom](https://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Copy-and-swap), or copy for modification.\r\n   If everybody agree on this, i can help with fixing ~400 occurrences of this issue in codebase. Please discuss."},"comment":{"url":"https://api.github.com/repos/tux3/qTox/issues/comments/226990589","html_url":"https://github.com/tux3/qTox/pull/3411#issuecomment-226990589","issue_url":"https://api.github.com/repos/tux3/qTox/issues/3411","id":226990589,"user":{"login":"Diadlo","id":6306608,"avatar_url":"https://avatars.githubusercontent.com/u/6306608?v=3","gravatar_id":"","url":"https://api.github.com/users/Diadlo","html_url":"https://github.com/Diadlo","followers_url":"https://api.github.com/users/Diadlo/followers","following_url":"https://api.github.com/users/Diadlo/following{/other_user}","gists_url":"https://api.github.com/users/Diadlo/gists{/gist_id}","starred_url":"https://api.github.com/users/Diadlo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Diadlo/subscriptions","organizations_url":"https://api.github.com/users/Diadlo/orgs","repos_url":"https://api.github.com/users/Diadlo/repos","events_url":"https://api.github.com/users/Diadlo/events{/privacy}","received_events_url":"https://api.github.com/users/Diadlo/received_events","type":"User","site_admin":false},"created_at":"2016-06-19T10:44:49Z","updated_at":"2016-06-19T10:44:49Z","body":"What about to make methods that do not change the object, constant?"}}
{"actor":{"display_login":"Diadlo"}}