Modify

Ticket #5178 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

class scoping directive for constructors is confusing to the compiler

Reported by: Erik Hovland <erik@…> Owned by: ijr
Priority: trivial Milestone: unknown
Component: mythtv Version: head
Severity: low Keywords:
Cc: Ticket locked: no

Description

Unfortunately using the class as a scoping directive to a constructor is ambiguous in the C++ standard. So using it makes the compiler work harder. For example: QTime epoch = QTime::QTime(1970, 1, 1);

The 'correct solution is to drop the class part of the call: QTime epoch(1970, 1, 1);

g++ is smart enough to understand what you mean when you use the scoping directive. But it can waste memory and can have trouble emitting information about the functions these sorts of calls are in. This means that static analysis tools may not be able to analyze the functions that these calls show up in. Which means that if there are defects in these functions they are not known.

I have prepared patches for each directory that these issues show up in and I am attaching them to this ticket.

Attachments

libs_libmyth-ctor-need-no-scoping-operators.patch (920 bytes) - added by Erik Hovland <erik@…> 4 years ago.
class scoping fixes in libs/libmyth/
libs_libmythtv-ctor-need-no-scoping-operators.patch (5.8 KB) - added by Erik Hovland <erik@…> 4 years ago.
class scoping fixes in libs/libmythtv/
programs_mythbackend-ctor-need-no-scoping-operators.patch (1.8 KB) - added by Erik Hovland <erik@…> 4 years ago.
class scoping fixes in programs/mythbackend/
programs_mythfrontend-ctor-need-no-scoping-operators.patch (1.8 KB) - added by Erik Hovland <erik@…> 4 years ago.
class scoping fixes in programs/mythfrontend/

Change History

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

class scoping fixes in libs/libmyth/

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

class scoping fixes in libs/libmythtv/

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

class scoping fixes in programs/mythbackend/

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

class scoping fixes in programs/mythfrontend/

comment:1 Changed 4 years ago by danielk

  • Status changed from new to closed
  • Resolution set to fixed

(In [17211]) Fixes #5178. Remove ambiguous class scoping for greater C++ portability.

View

Add a comment

Modify Ticket

Action
as closed
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.