Closed
Bug 173894
Opened 22 years ago
Closed 22 years ago
cleanup QIs in nsComposerCommands.cpp
Categories
(SeaMonkey :: Composer, defect)
SeaMonkey
Composer
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: Brade, Assigned: Brade)
Details
Attachments
(1 obsolete file)
As part of another bug, a comment was made about making the QI's in this file more efficient. That work was not done in that bug so this bug will cover that issue.
| Assignee | ||
Comment 1•22 years ago
|
||
Comment 2•22 years ago
|
||
Comment on attachment 102549 [details] [diff] [review] clean up QI calls r=axel@pike.org someone should clean up the the inconsistent use of if (!foo) return NS_ERROR some day. I prefer two lines.
Attachment #102549 -
Flags: review+
Comment 3•22 years ago
|
||
Comment on attachment 102549 [details] [diff] [review] clean up QI calls sr=peterv. Cleaning up the return style indeed would be nice some day.
Attachment #102549 -
Flags: superreview+
Is there really any difference in efficiency between these two forms? Don't optimizers optimize away the difference? (Do you see any difference in the generated code in a non-DEBUG build?) I vaguely remember an issue like this where there was no difference on most compilers, and on the one where there was a difference, the theoretically slower version was faster. bbaetz might remember.
Comment 5•22 years ago
|
||
There is no difference. In fact, on gcc-2.96, for non optimised builds only, the = form is in fact 1 byte shorter (No, I don't know why). It was a while ago when I tested, and I don't know if that still holds true for gcc-3.2, but since any optmisiation level makes it moot, I don't think that we should care. See http://scottcollins.net/programming/cpp/initialization.html
| Assignee | ||
Comment 6•22 years ago
|
||
I think it was alecf who requested this form be used AlecF--can you please post your comments here?
Comment 7•22 years ago
|
||
Comment on attachment 102549 [details] [diff] [review] clean up QI calls no.. it was not me and in fact this is completely unnecessary. There was a time that we believed that this saved a few instructions to call the default constructor for nsCOMPtr<T> before calling the = operator.. then it turned out that most compilers are pretty darn smart and that the compled code was more or less the same (and I think on some compilers was even identical) I personally find this form less readable, and would be against making changes in a module I owned. I don't recommend it.
| Assignee | ||
Comment 8•22 years ago
|
||
Comment on attachment 102549 [details] [diff] [review] clean up QI calls hmmmm... sorry alecf! I don't recall which super-reviewer wanted it the other way (it wasn't one of my bugs that this issue came up on). I will redo the patch to be consistent the other way. Thanks!
Attachment #102549 -
Attachment is obsolete: true
| Assignee | ||
Comment 9•22 years ago
|
||
I think it was Darin who requested the other format for the do_QueryInterface
Comment 10•22 years ago
|
||
hrm... well, ok, i stand corrected then. a year or so ago i asked about this because a number of people (i forget who) told me to not use operator= for nsCOMPtr initialization. i wasn't convinced until i asked scc about it. he said he had done some simple tests to confirm that more code is generated and that that would obviously require more of the optimizer to eliminate the unnecessary code. he said that most compilers get this right, but that it would probably not be a bad idea to use the "less code" form. i guess i missed the thread about the fact that we are happy with the optimized code generated on all platforms :-/
Comment 11•22 years ago
|
||
yeah, there definitely was a time when we tried to avoid operator= at all costs, but I think it was down to a difference of something like one instruction. "We" decided (I think really just scc decided and word spread) it didn't really matter THAT much. I think basically we got less strict about it when we realized how minor the impact actually was.
| Assignee | ||
Comment 12•22 years ago
|
||
at a glance, it now looks like we consistently use = in the file so resolving this as fixed
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•