Anonymous | Login | 2024-10-11 12:28 CDT |
My View | View Issues |
View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0000228 | Rosetta | [All Projects] Bad Coding | public | 2013-03-22 17:02 | 2013-11-18 16:49 | ||||
Reporter | rmoretti | ||||||||
Assigned To | rmoretti | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | resolved | Resolution | fixed | ||||||
Platform | OS | OS Version | |||||||
Product Version | Trunk | ||||||||
Fixed in Version | |||||||||
Summary | 0000228: ScoreFunction cloning | ||||||||
Description | Because of the distinction between ScoreFunction and SymmetricScoreFunction (as well as the other ScoreFunction subclasses), you should never use the copy constructor of ScoreFunction() to make a new copy of a ScoreFunction. Use scorefxn.clone() instead. Note there's no drawback to this, even if you know that you have a true ScoreFunction. | ||||||||
Steps To Reproduce | To find potential violators: egrep -R 'new[[:space:]]*ScoreFunction[[:space:]]*\([^)]' rosetta/rosetta_source/src | ||||||||
Additional Information | Command currently finds 66 instances. Some are valid, like the 7 in will and neil's apps/pilot directories, which are explicitly intended to take a symmetric scorefunction and asymmetrize it. Most of the rest are probably latent bugs. They'll need to be checked manually, though. | ||||||||
Tags | No tags attached. | ||||||||
Application(s) Affected | many | ||||||||
Command Line Used | n/a | ||||||||
Developer Options | |||||||||
Fixed in SVN Version | 36c2c81b7794e1f70a9520da778b3239dc3757a5 | ||||||||
Attached Files | |||||||||
Notes | |
(0000210) smlewis (Administrator) 2013-03-22 17:25 |
Is there a future in privatizing the copy operator to force people to use clone? I am guessing not from your notes. |
(0000211) Sergey (Administrator) 2013-03-22 17:28 |
As Steven suggested: How about declare copy constructor and copy operator as private and never define them? That way it will be impossible to copy without clone. |
(0000212) rmoretti (Attentive Developer) 2013-03-24 19:03 |
If we provide a new method for those few people who explicitly want to convert a scorefunction to the base class (with a name that makes it clear that's what they're doing), I think making the copy constructor private might work. |
Issue History | |||
Date Modified | Username | Field | Change |
2013-03-22 17:02 | rmoretti | New Issue | |
2013-03-22 17:25 | smlewis | Note Added: 0000210 | |
2013-03-22 17:28 | Sergey | Note Added: 0000211 | |
2013-03-24 19:03 | rmoretti | Note Added: 0000212 | |
2013-11-18 16:49 | rmoretti | Fixed in SVN Version | => 36c2c81b7794e1f70a9520da778b3239dc3757a5 |
2013-11-18 16:49 | rmoretti | Status | new => resolved |
2013-11-18 16:49 | rmoretti | Resolution | open => fixed |
2013-11-18 16:49 | rmoretti | Assigned To | => rmoretti |
Copyright © 2000 - 2012 MantisBT Group |