Opened 17 years ago
Closed 17 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)
by , 17 years ago
| Attachment: | libs_libmyth-useless-const-qualifier.patch added |
|---|
by , 17 years ago
| Attachment: | libs_libmythtv-useless-const-qualifier.patch added |
|---|
removes unused const directive on some functions in libmythtv
comment:2 by , 17 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
The libmythtv patch is an incorrect fix. We should be returning pointers to const classes, not const pointers.
comment:3 by , 17 years ago
Daniel. close this one. I will rework the patch if it becomes necessary.
comment:4 by , 17 years ago
| 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