Skip to content

Commit

Permalink
Eliminate warning C4800.
Browse files Browse the repository at this point in the history
  • Loading branch information
nitrocaster committed Dec 4, 2015
1 parent df49fa4 commit 30d1f85
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/xrCore/Threading/Lock.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class XRCORE_API Lock
lockCounter--;
}

bool IsLocked() const { return lockCounter; }
bool IsLocked() const { return !!lockCounter; }

private:
std::recursive_mutex mutex;
Expand Down

4 comments on commit 30d1f85

@Kaffeine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be said, lockCounter != 0 also does the trick and is (may be) more readable.

@nitrocaster
Copy link
Member

@nitrocaster nitrocaster commented on 30d1f85 Dec 4, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kaffeine
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't you agree that x != 0 is, say, five times more known and popular, than !!x?
I saw !! only in expressions such as

features_count = !!first_feature_things_count + !!degree_of_the_second_feature + !!third_feature_object_count.

As usual, we all have habits, which rule on readability.

@nitrocaster
Copy link
Member

@nitrocaster nitrocaster commented on 30d1f85 Dec 4, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.