Closed Bug 629289 Opened 12 years ago Closed 12 years ago

forcing value to bool (performance warning C4800)

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla2.0b11

People

(Reporter: surkov, Assigned: surkov)

Details

(Keywords: access)

Attachments

(1 file)

Attached patch patchSplinter Review
      No description provided.
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?
(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
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+
landed on 2.0 - http://hg.mozilla.org/mozilla-central/rev/a2d89cf5cd18
Target Milestone: --- → mozilla2.0b11
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.