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
 Feature for special functions...
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dango
Junior Member

20 Posts

Posted - Dec 05 2006 :  08:42:18 AM  Show Profile  Reply with Quote
I haven't totally figured out what I want but let me explain the scenario.

When creating special member function: copy constructor; assignment operator its important to make sure we have copied, all the member variables. Would it be possible to check tat all member variables are referenced in these functions? Or simply insert a template for these functions that is just {lhs.a = rhs.a; lhs.b = rhs.b ...} for each member variable? Then I can edit it from there. Periodicall I could re-insert the template and check that I'm not missing anything.

Thanks,
DanGo

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Dec 05 2006 :  10:12:32 AM  Show Profile  Reply with Quote
A very interesting idea, I have put in a feature request for the developers to consider.

case=3945

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

bugfix
Tomato Guru

Germany
324 Posts

Posted - Dec 06 2006 :  09:24:52 AM  Show Profile  Reply with Quote
how about making a small helper function which you call in your copy ctor /assignment operator and use vs builtin classbrowser to check that all members are used?

-bugfix

http://www.mf-sd.de
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19022 Posts

Posted - Dec 07 2006 :  10:01:20 AM  Show Profile  Reply with Quote
My gut instinct is that this is harder, and will have more edge cases. I know myself well enough to know that I would start to rely on any such function, once it existed, so it would need to be very reliable.

The immediate problem is to define "used". This could be defined as each member variable is referenced in the function, but is this the correct test?

The second problem is when should this be enabled? When I have classes that define both a copy constructor and an assignment operator I have a function clone(...) and these two functions both call clone() which deals with all of the member variables, so I only have one function to update and keep an eye on.

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

bugfix
Tomato Guru

Germany
324 Posts

Posted - Dec 07 2006 :  10:14:23 AM  Show Profile  Reply with Quote
heh, this was meant for dango. sorry if it wasnt clear.

http://www.mf-sd.de
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000