Closed Bug 3484 Opened 26 years ago Closed 26 years ago

Make "in string" and "in wstring" create const params

Categories

(Core :: XPCOM, defect, P1)

All
Windows NT
defect

Tracking

()

RESOLVED FIXED

People

(Reporter: waterson, Assigned: shaver)

Details

From n.p.m.xpcom... Chris Waterson wrote: > > Could we please make "in" parameters generate "const" declarations where > appropriate (most notably, on string and wstring)? This'll save a lot of > atrocious const-casting in C++ code. > > We probably can't make object references "const" (because the callee may > decide to hold onto it, which may require an AddRef()). That makes sense to me. strings and nsIDs are the only pointer (or reference) type 'in' params we have (excluding the 'native' types). They ought to be const - else they should be declared as in/out params in the idl. I agree that interface pointers should certainly not be declared const. Though not just because the callee might choose to hold a reference, but also because we can make no assertions about whether or not the callee might want to call non-const methods on the interface. John.
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Fixed: /* void method (in string istr, inout string iostr, out string ostr); */ NS_IMETHOD method(const char *istr, char **iostr, char **ostr) = 0; /* void wmethod (in wstring istr, inout wstring iostr, out wstring ostr); */ NS_IMETHOD wmethod(const PRUnichar *istr, PRUnichar **iostr, PRUnichar **ostr) = 0;
bulk reassigning all bugs from shaver's @netscape account to his @mozill acount
Component: xpidl → XPCOM
QA Contact: vidur → xpcom
You need to log in before you can comment on or make changes to this bug.