Const-correct Mozilla code

RESOLVED WONTFIX

Status

Firefox Build System
Source Code Analysis
RESOLVED WONTFIX
10 years ago
a day ago

People

(Reporter: kschwarz, Assigned: Joel Galenson)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
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.

Comment 1

10 years ago
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?
(Reporter)

Comment 2

10 years ago
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.

Comment 3

10 years ago
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.
(Reporter)

Updated

10 years ago
Blocks: 430328

Updated

3 months ago
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
Last Resolved: a day ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.