Closed Bug 449623 Opened 16 years ago Closed 6 years ago

Const-correct Mozilla code

Categories

(Developer Infrastructure :: Source Code Analysis, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: kschwarz, Assigned: jgalenson)

References

Details

The mozilla-central code base is, for the most part, not const-correct.  Developers who want to write const-correct code commonly have to rewrite or const-overload functions in other parts of the source.  We propose using dehydra to automatically const-correct as much of the code base as possible.
What kinds of things do you think should be const-correct? Anything that goes through xpidl and javascript cannot be const (because JS doesn't not have that concept).

Strings and the basic data structures are for the most part const-correct... can you give examples?
My main experience has been with nsIFrame and nsIView, neither of which is const-correct.  I don't think that either of these classes go through XPIDL, since some of the functions are already const-corrected.  When working on the CSS transforms patch, I ended up const-correcting a good number of member and helper functions, and though I don't have as much experience working with other parts of the code base, I'm pretty sure that other modules could be similarly improved.  Even if we weren't able to make the entire code base const-correct, if we were simply able to make some of the modules internally const-correct, I think it would make the code a lot less bug-prone.
Well, doing this mozilla-wide sounds tricky if only because breaking public interfaces sucks. But i'm sure some of this is doable. best place to start would be to find a piece of code that isn't const correct and start devising steps needed to detect & convert it.
Product: Core → Firefox Build System
While this is a good thing, we're not going to write an analysis for it, and I think people are better about sticking const in places where it logically belongs nowadays.
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
Product: Firefox Build System → Developer Infrastructure
You need to log in before you can comment on or make changes to this bug.