Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Change Signature on virtual functions
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

JohnCrenshaw
Junior Member

18 Posts

Posted - Dec 13 2006 :  11:27:24 AM  Show Profile  Reply with Quote
I recently did a Change Signature on a virtual function changing both the name and some other attributes. I was pleasantly surprised to find that the rename filtered down to all of the derived classes as well, however, the rest of the signature only changed for my base class.

I'd like to make a case for changing the signature across the board, at least where class inheritance and the virtual keyword makes the functions effectively the same.

1. If a virtual function is refactored and remains virtual, it makes sense to change all of the equivalent functions in all derived classes.
2. The reason is that these are functionally the same, and calling the virtual function causes a call to the highest level override defined for the object.
3. If some (but not all) of the the signatures suddenly become different, the function that gets called in any given case has now changed because virtual only works if the signatures are the same.
4. This is bad because the ChangeSignature function should generally leave the code opperating exactly as it did before. (In fact a message is given warning about references not being changed because the user would expect all to work as before.)
5. The references problem for which a message is popped up will generally generate compiler errors/warnings because the function name and/or signature doesn't resolve to a valid symbol anymore, however, this virtual function problem causes neither errors nor warnings in most cases, because all declarations and symbols are just as valid as they were before, even though they are behaviorly different. The absence of warnings means that if a developer is not really on the ball, they could silently introduce major bugs.

feline
Whole Tomato Software

United Kingdom
17256 Posts

Posted - Dec 13 2006 :  12:20:55 PM  Show Profile  Reply with Quote
This is on our list of things to consider doing

case=3373

zen is the art of being at one with the two'ness
Go to Top of Page

sean
Whole Tomato Software

USA
2817 Posts

Posted - Nov 18 2013 :  3:25:40 PM  Show Profile  Reply with Quote
Change Signature was overhauled in build 2007 and now supports changes to a class hierarchy.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2019 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000