Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#3839 closed enhancement (complete)

unused exception

Reported by: fdupont Owned by: fdupont
Priority: low Milestone: Kea0.9.2
Component: Unclassified Version: git
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DHCP Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 0
Total Hours: 0 Internal?: no

Description

In
catch (const std::exception& ex) {
the ex variable must be used in the catch body.

Subtickets

Change History (8)

comment:1 Changed 5 years ago by fdupont

  • Owner set to fdupont
  • Status changed from new to accepted

comment:2 Changed 5 years ago by fdupont

IMHO this comes from the abusive no-unused-xxx which makes some compilers not complaining.
So:

  • it is useless (and as it adds 3 spurious characters bad) to put a variable in a catch without the intention to use it.
  • unused parameters in a function definition should be put into a comment so compilers can't see them and are happy, and readers have still an idea the parameter was for.

A special case for main(): a program without arguments should be simply define with int main() { ... } .

comment:3 Changed 5 years ago by fdupont

Ready for review.

comment:4 Changed 5 years ago by fdupont

  • Owner changed from fdupont to UnAssigned
  • Status changed from accepted to reviewing

comment:5 Changed 4 years ago by stephen

  • Owner changed from UnAssigned to stephen

comment:6 Changed 4 years ago by stephen

  • Owner changed from stephen to fdupont

Reviewed commit 3a738842507872fcf9a6415772a03c6bf4d3b5df

src/lib/dhcpsrv/lease_file_loader.h
Line 203-205: not part of your changes but immediately after a line you changed. Could you indent them appropriately before merging?

src/lib/dns/rdata.cc
Needs the copyright date updated.


These changes are not user-visible and have no effect on the execution of the program, only on the compilation. I don't think they need a ChangeLog entry.

comment:7 Changed 4 years ago by fdupont

  • Resolution set to complete
  • Status changed from reviewing to closed

Merged, closing. BTW I added a recommendation in coding guidelines explaining either there is no variable, or there is one and it is used
(usually by calling what() method).

comment:8 Changed 4 years ago by hschempf

  • Milestone changed from Kea-proposed to Kea0.9.2
Note: See TracTickets for help on using tickets.