Opened 16 years ago
Closed 15 years ago
#5540 closed defect (invalid)
In some instances where the member function is const, the return type does not need the const directive
Reported by: | Owned by: | danielk | |
---|---|---|---|
Priority: | trivial | Milestone: | unknown |
Component: | mythtv | Version: | head |
Severity: | low | Keywords: | |
Cc: | Ticket locked: | no |
Description
When a function is declared const like
const int getState() const { return curState; }
The const at the return type is redundant. In fact it causes the compiler to generated a parse warning internally that causes extra code to execute. By stripping off the extra const the compiler does not produce a parse warning and the compiled object code is unchanged.
int getState() const { return curState; }
This defect has no effect on runtime. It is entirely for compiler correctness.
Attachments (2)
Change History (6)
Changed 16 years ago by
Attachment: | libs_libmyth-useless-const-qualifier.patch added |
---|
Changed 16 years ago by
Attachment: | libs_libmythtv-useless-const-qualifier.patch added |
---|
removes unused const directive on some functions in libmythtv
comment:2 Changed 16 years ago by
Owner: | changed from Isaac Richards to danielk |
---|---|
Status: | new → assigned |
The libmythtv patch is an incorrect fix. We should be returning pointers to const classes, not const pointers.
comment:3 Changed 16 years ago by
Daniel. close this one. I will rework the patch if it becomes necessary.
comment:4 Changed 15 years ago by
Resolution: | → invalid |
---|---|
Status: | assigned → closed |
"Daniel. close this one. I will rework the patch if it becomes necessary."
removes unused const directive on some functions in libmyth