Closed Bug 1189006 Opened 10 years ago Closed 10 years ago

eliminate NSCAP_Zero* operator== overloads in favor of explicit operator bool()

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: froydnj, Assigned: froydnj)

Details

Attachments

(1 file)

No description provided.
I'm pretty sure this is the new, modern C++ way to do this, but I'd definitely appreciate a second pair of eyes on this.
Attachment #8640643 - Flags: review?(botond)
Comment on attachment 8640643 [details] [diff] [review] eliminate NSCAP_Zero* operator== overloads in favor of explicit operator bool() Review of attachment 8640643 [details] [diff] [review]: ----------------------------------------------------------------- Summarizing feedback given on IRC: - The NSCAP_Zero* operator overloads allow code of the form 'smartPointer == 0' and 'smartPointer == nullptr'. They are unrelated to being able to do 'if (smartPointer)', which works via the implicit 'operator T*'. - The 'explicit operator bool()' does not replace the NSCAP_Zero* overloads in allowing 'smartPointer == 0' or 'smartPointer == nullptr' conversions. It would enable 'if (smartPointer)', if that weren't already possible via the implicit 'operator T*'. Therefore, this patch doesn't make much sense as-is. If we want to disallow 'smartPointer == 0' and 'smartPointer == nullptr', we can just remove the NSCAP_Zero* overloads. I'm OK with that.
Attachment #8640643 - Flags: review?(botond)
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: