forcing value to bool (performance warning C4800)

RESOLVED FIXED in mozilla2.0b11

Status

()

Core
Disability Access APIs
RESOLVED FIXED
7 years ago
7 years ago

People

(Reporter: surkov, Assigned: surkov)

Tracking

({access})

unspecified
mozilla2.0b11
access
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

7 years ago
Created attachment 507365 [details] [diff] [review]
patch
Attachment #507365 - Flags: review?(bolterbugz)
Attachment #507365 - Flags: approval2.0?
Comment on attachment 507365 [details] [diff] [review]
patch

I'm not sure this patch actually fixes perf right? There is still a !! conversion. Does just adding !! fix the warning?
(Assignee)

Comment 2

7 years ago
(In reply to comment #1)
> Comment on attachment 507365 [details] [diff] [review]
> patch
> 
> I'm not sure this patch actually fixes perf right?

there is I think, implicit conversion costs something.

> There is still a !!
> conversion.

for the second case

> Does just adding !! fix the warning?

yes, perhaps static_cast<bool> is better here, dunno
(Assignee)

Comment 3

7 years ago
Neil, what's better:

bool IsBoundToParent() const { return !!mParent; }

or

bool IsBoundToParent() const { return static_cast<bool>(mParent); }
(In reply to comment #3)
> bool IsBoundToParent() const { return static_cast<bool>(mParent); }

Neil tells me this won't remove the warning.
Comment on attachment 507365 [details] [diff] [review]
patch

r+a=me, we probably don't want to take two many low priority bugs like this until after 4 ships. Can you ride this patch along one of your pushes to try to make sure we don't have an freaky failures?
Attachment #507365 - Flags: review?(bolterbugz)
Attachment #507365 - Flags: review+
Attachment #507365 - Flags: approval2.0?
Attachment #507365 - Flags: approval2.0+
(Assignee)

Comment 6

7 years ago
landed on 2.0 - http://hg.mozilla.org/mozilla-central/rev/a2d89cf5cd18
Target Milestone: --- → mozilla2.0b11
(Assignee)

Updated

7 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.