Summary: | Make functions in Localizer class "const" | ||
---|---|---|---|
Product: | WebKit | Reporter: | yosin |
Component: | Platform | Assignee: | Nobody <webkit-unassigned> |
Status: | NEW --- | ||
Severity: | Normal | CC: | ap |
Priority: | P2 | ||
Version: | 528+ (Nightly build) | ||
Hardware: | Unspecified | ||
OS: | Unspecified |
Description
yosin
2012-09-27 21:57:52 PDT
I'm not convinced that this is a worthwhile thing to do. Const is not really useful for optimization, because the qualifier can be dropped with const_cast at any time, and compiler must expect that. And extra visual noise does not improve readability. Const is useful to statically ensure correctness, which is not an issue for immutable objects like Localizer class instances. There are additional considerations why we don't use const in other cases (e.g. why we don't use "const Node&"), which are out of scope to discuss here. Making Localizer "const" may reduce below comments during review. Also for me, adding "const" improves readability. From review for https://bugs.webkit.org/show_bug.cgi?id=97318 View in context: https://bugs.webkit.org/attachment.cgi?id=165971&action=review > Source/WebCore/html/shadow/DateTimeNumericFieldElement.h:75 > + Localizer& localizer() const; Can the return value be const? |