-
Notifications
You must be signed in to change notification settings - Fork 151
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
Refactor and disallow type conversion operators #6373
Refactor and disallow type conversion operators #6373
Conversation
Assigned to Nordfriese |
…onversion-operators
…onversion-operators
…onversion-operators
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mirrored from Codeberg
On Sat Jun 01 10:28:04 CEST 2024, matthiakl commented:
LGTM. I don't see any behavior changes.
Some comments are obsolete now.
src/io/fileread.h
Outdated
@@ -34,10 +34,10 @@ | |||
class FileRead : public StreamRead { | |||
public: | |||
struct Pos { | |||
Pos(size_t const p = 0) : pos(p) { // NOLINT allow implicit conversion | |||
explicit Pos(size_t const p = 0) : pos(p) { // NOLINT allow implicit conversion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mirrored from Codeberg
On Sat Jun 01 10:28:04 CEST 2024, matthiakl wrote:
- Pos(size_t const p = 0) : pos(p) { // NOLINT allow implicit conversion
+ explicit Pos(size_t const p = 0) : pos(p) {
No implicit conversion allowed.
src/io/filewrite.h
Outdated
@@ -30,11 +30,11 @@ class FileSystem; | |||
class FileWrite : public StreamWrite { | |||
public: | |||
struct Pos { | |||
Pos(size_t const p = 0) : pos(p) { // NOLINT allow implicit conversion | |||
explicit Pos(size_t const p = 0) : pos(p) { // NOLINT allow implicit conversion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mirrored from Codeberg
On Sat Jun 01 10:29:32 CEST 2024, matthiakl wrote:
- Pos(size_t const p = 0) : pos(p) { // NOLINT allow implicit conversion
+ explicit Pos(size_t const p = 0) : pos(p) {
No implicit conversion allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mirrored from Codeberg
On Sat Jun 01 22:29:57 CEST 2024, matthiakl approved this pull request:
<@>bunnybot merge
comment deleted |
widelands#4736) Co-authored-by: Benedikt Straub <[email protected]> Co-committed-by: Benedikt Straub <[email protected]>
Mirrored from Codeberg deleted comment |
Mirrored from Codeberg Mirrored from GitHub Mirrored from Codeberg Mirrored from GitHub Mirrored from Codeberg Mirrored from GitHub Mirrored from Codeberg Mirrored from GitHub Mirrored from Codeberg Mirrored from GitHub Mirrored from Codeberg Mirrored from GitHub Mirrored from Codeberg Mirrored from GitHub Mirrored from Codeberg Mirrored from GitHub Mirrored from Codeberg Mirrored from GitHub Mirrored from Codeberg Thanks for the review :) <@>bunnybot merge |
Mirrored from Codeberg
Created on Sat Feb 24 13:37:22 CET 2024 by Benedikt Straub (Nordfriese)
Type of change
Refactoring
Issue(s) closed
Implicit type conversions are bad. This branch replaces all custom conversion operators with explicit functions, and adds a codecheck rule against type conversion operators.
Possible regressions
Validity and value of
Coords
,Vision
/VisibleState
,MessageID
, andFileRead::Pos
/FileWrite::Pos
.