Closed
Bug 504727
Opened 16 years ago
Closed 16 years ago
Create an already_Transferred helper for nsAutoPtr
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: bzbarsky, Assigned: bzbarsky)
References
Details
Attachments
(1 file, 1 obsolete file)
|
3.82 KB,
patch
|
Details | Diff | Splinter Review |
Just a way to annotate return values that the callee should own and delete.
Attachment #389076 -
Flags: review?(dbaron)
| Assignee | ||
Comment 1•16 years ago
|
||
Attachment #389076 -
Attachment is obsolete: true
Attachment #389417 -
Flags: review?(dbaron)
Attachment #389076 -
Flags: review?(dbaron)
| Assignee | ||
Updated•16 years ago
|
Attachment #389417 -
Flags: review?(benjamin)
I really don't like the name. I think "already" isn't really appropriate in this case. It's not a matter of when a reference count is being incremented, it's a matter of ownership being transferred. (I think a good name for this class could probably be applied back to renaming already_AddRefed if we really wanted to, although I doubt it would be worth it.)
I've been trying to think if I can get a good name out of things like "caller owns" or "must free", but I'm not too happy with them either.
OS: Mac OS X → All
Hardware: x86 → All
Comment 3•16 years ago
|
||
Comment on attachment 389417 [details] [diff] [review]
Without the bogus assert
Is the goal to make the code more readable, or prevent some bad construct from happening at compile-time? I really don't think this makes it any more readable.
| Assignee | ||
Comment 4•16 years ago
|
||
The goal is to keep:
nsFoo* foo = GetFoo();
from compiling and to make it clear to anyone reading the header that GetFoo() needs to be assigned into an nsAutoPtr.
Could call it caller_MustFree
Comment 5•16 years ago
|
||
boost::scoped_ptr doesn't have a similar helper... I'm skeptical that the reward/confusion factor makes this worthwhile.
| Assignee | ||
Comment 6•16 years ago
|
||
I can live with wontfixing this; just would like us to make a call so I can land (or modify and land) the patches in bug 504221.
| Assignee | ||
Comment 7•16 years ago
|
||
OK, per ircdiscussion with Benjamin, wontfix.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → WONTFIX
| Assignee | ||
Updated•16 years ago
|
Attachment #389417 -
Flags: review?(dbaron)
Attachment #389417 -
Flags: review?(benjamin)
You need to log in
before you can comment on or make changes to this bug.
Description
•