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: Erik Hovland <erik@…> 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)

libs_libmyth-useless-const-qualifier.patch (1.4 KB) - added by Erik Hovland <erik@…> 16 years ago.
removes unused const directive on some functions in libmyth
libs_libmythtv-useless-const-qualifier.patch (5.8 KB) - added by Erik Hovland <erik@…> 16 years ago.
removes unused const directive on some functions in libmythtv

Download all attachments as: .zip

Change History (6)

Changed 16 years ago by Erik Hovland <erik@…>

removes unused const directive on some functions in libmyth

Changed 16 years ago by Erik Hovland <erik@…>

removes unused const directive on some functions in libmythtv

comment:1 Changed 16 years ago by danielk

(In [17829]) Refs #5540. Removes no-op const's in libmyth

comment:2 Changed 16 years ago by danielk

Owner: changed from Isaac Richards to danielk
Status: newassigned

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 Erik Hovland <erik@…>

Daniel. close this one. I will rework the patch if it becomes necessary.

comment:4 Changed 15 years ago by danielk

Resolution: invalid
Status: assignedclosed

"Daniel. close this one. I will rework the patch if it becomes necessary."

Note: See TracTickets for help on using tickets.