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 of format for output parameters
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

jmpep
New Member

2 Posts

Posted - Jun 17 2011 :  09:27:15 AM  Show Profile  Reply with Quote
Hi! Just a quick suggestion.

In our code base we have a lot of methods that use output parameters (for example when a function has to return several things, as usual). For performance considerations, these output parameters are not pointers, but references. For example:

calculate_b_from_a( const Object & a, Object b );

It's easy to tell which parameters is for input and which for output from the signature of the method declaration (thanks to the const keyword), but not from a method call:

calculate_b_from_a( a, b );

We would be delighted if Tomato could find out which method is const and which is not, and colour the parameters in the method call differently. That way we could see which parameters will be filled by the method and which not at first glance.

PS: Congratulations on this excelent software, by the way :)

Edited by - jmpep on Jun 17 2011 09:28:06 AM

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jun 17 2011 :  5:50:31 PM  Show Profile  Reply with Quote
I am not quite sure what to say here. This is a very interesting idea, but it is only going to be helpful some of the time, since it requires / assumes that any parameter that is not going to be modified is labelled as const. Personally I feel this is how code should be written, but I am aware a lot of code is not written this way.

We are considering highlighting references in Find References Results that might be modified in a 3rd colour, which is the same idea, just in a more limited scope:

case=9955

One of the practical problems here is that this requires VA knowing which overload is being called. Currently VA cannot work out which overload you are calling, so this cannot really be applied to overloaded functions at this time. Also we need to keep our syntax highlighting code very "simple", otherwise it cannot run fast enough to keep up with scrolling and editing. Having to look up every function signature before deciding the colouring could be a significant overhead.

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

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jun 18 2011 :  09:13:33 AM  Show Profile  Reply with Quote
Thinking about this some more, are you aware that if you place the caret into the function name, VA shows the function signature in its definition bar? This is normally at the top of the editor:

http://www.wholetomato.com/products/features/definition.asp

My concern here is that if we tried to make this change, then why is it only limited to function calls? Will the next reply to make non const local variables, parameters to functions, etc, a different colour? We are trying to avoid the situation where every symbol is a different colour, since this is likely to confuse more than it helps.

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

jmpep
New Member

2 Posts

Posted - Jun 21 2011 :  06:25:35 AM  Show Profile  Reply with Quote
Thanks you very much for the prompt reply! :)

I know VA shows the function signature, but albeit useful it does not assist much in certain scenarios.

For example, imagine we are debugging, and we (finally!) find out that a variable have changed its value within a (rather large) function. Now we want to know where. Unfortunately, the variable might have been changed not only in an assignment sentence ("variable = val"), but also anywhere where it is used as parameter to a function. Well, of course, only when it is used as an output parameter, but since we have no way of telling when it is an output parameter and when an input one...

In that case, if VA provided a cue it would be wonderful.

Anyway, I always meant this feature to be an option that could be enabled. I understand that there is code that makes no use of const at all, and thus there is no way of telling (automatically) which parameters are for input or output.

Finally, as for the Find References Result, I am afraid I am unable to see how that would help with this issue... maybe I didn't understand it fully?

Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18939 Posts

Posted - Jun 21 2011 :  10:06:54 AM  Show Profile  Reply with Quote
If I understand your situation correctly, you could do a Find References on the variable in question, and once case=9955 is done, look for any references that are highlighted as modified, or possibly modified.

There should not be any references highlighted as modified, so you would be able to focus on the possibly modified references. These should be any function calls where the variable is passed by reference or pointer, so allowing it to be modified.

zen is the art of being at one with the two'ness
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