Closed
Bug 49640
Opened 24 years ago
Closed 15 years ago
C cast used on C++ object
Categories
(Core :: XPCOM, defect)
Core
XPCOM
Tracking
()
RESOLVED
INCOMPLETE
People
(Reporter: bruce, Unassigned)
References
(Blocks 1 open bug, )
Details
nsIFile.idl has this line in it:
*result = (nsIFile*)dir.get();
The HP compiler warns about this, but I was under the impression that we
shouldn't be using C-style casts on any C++ objects like that.
For reference, the HP warning is:
Warning 749: "../../dist/include/nsIFile.h", line 761 # The cast from
'nsDerivedSafe<nsISupports> *' to 'nsIFile *' is performed as a
'reinterpret_cast'. This operation is non-portable and potentially unsafe.
*result = (nsIFile*)dir.get();
Comment 1•24 years ago
|
||
Doing a simple search, for example, on ".get()" would seem ti indicate that this
type of cast is being done all over the place. Are the others somehow not
reported as warnings by the HP compiler? What would you suggest to replace this
reinterpret cast?
Reporter | ||
Comment 2•24 years ago
|
||
Some are ... I've reported most of the non-mail/news instances of this warning.
If nothing else, it'd be nice to see the actual C++ cast via NS_REINTERPRET_CAST
used rather than the C-style one.
One other thing that I'm not clear on is what the order of operations is in the
case of this expression. Is it doing: ((nsIFile*)dir).get(), or is it doing
(nsIFile*)(dir.get()) ?
Comment 3•24 years ago
|
||
I was just determining the priority so I could triage it properly.
Dots bind much tighter than casting. You always have to use extra parents to
cast before using a dot.
Are you saying the HP warning goes a way when we use REINTERPRET_CAST? If so,
I'd hope we could make a single bug and get someone to go through all the source
eliminating the older form. I am making this future.
Status: NEW → ASSIGNED
Target Milestone: --- → Future
Reporter | ||
Comment 4•24 years ago
|
||
I already went through the HP build logs and filed almost all of the appropriate
bugs. (I left out anything involving structs rather than real C++ classes.)
If I submit a patch for this trivial fix to nsIFile.idl, can you review it, so
that I can get it approved by waterson? (This particular warning is the single
most common instance of it in the source, with the 2nd most common being some
xpconnect ones that jband is already on.)
Comment 5•24 years ago
|
||
Edward: Welcome to xpcom!
Status: ASSIGNED → NEW
QA Contact: leger → rayw
Target Milestone: Future → mozilla1.0
Comment 6•24 years ago
|
||
Once again... attempting to reassign from Ray to Edward.
Assignee: rayw → kandrot
Comment 7•24 years ago
|
||
Submit the patch, and I'll review it (rayw is no longer associated with XPCOM).
Status: NEW → ASSIGNED
QA Contact: rayw → scc
Updated•23 years ago
|
Assignee: kandrot → dougt
Status: ASSIGNED → NEW
Target Milestone: mozilla1.0 → ---
Comment 8•23 years ago
|
||
reassign all kandrot xpcom bug.
Updated•23 years ago
|
Keywords: helpwanted
Target Milestone: --- → Future
Updated•21 years ago
|
Blocks: buildwarning
Updated•19 years ago
|
Assignee: dougt → nobody
QA Contact: scc → xpcom
Comment 9•15 years ago
|
||
Don't care about C casts enough to keep this bug open.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INCOMPLETE
Updated•15 years ago
|
Priority: P3 → --
Target Milestone: Future → ---
Updated•15 years ago
|
Keywords: helpwanted
You need to log in
before you can comment on or make changes to this bug.
Description
•