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
 Technical Support
 Auto-complete of implementation fails to add const
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

KirillMueller
Ketchup Master

72 Posts

Posted - Aug 19 2006 :  08:06:49 AM  Show Profile  Reply with Quote
When declaring

class A {
   int someMethod(int a, int b) const;
};

in a header file, typing

int A::someMethod(

leads to suggestion of

int a, int b) { ... }

so that after confirming the suggestion, the implementation reads

int A::someMethod(int a, int b) {

}

Note the missing "const" after the closing paren. This code won't compile.

"Add implementation" from the new refactoring functions does not feature this problem, but has other drawbacks.

VAX 1532, but I remember the 1400 series also having this problem.

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Aug 20 2006 :  4:24:06 PM  Show Profile  Reply with Quote
other than the positioning of the new function most of the problems with Create Implementation should be fixed in the next few builds of VA.

what puzzles me here is the suggestion you are getting. when i do this i get the parameters suggested, but no closing bracket, and no curly brackets for the body:



given this suggestion, there is no easy way for VA to suggest the const, which goes after the closing bracket. is it possible for you to post a screen shot of the suggestion you are getting? i wonder if we are talking about different things.

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

KirillMueller
Ketchup Master

72 Posts

Posted - Aug 20 2006 :  4:32:05 PM  Show Profile  Reply with Quote
Sorry, my description was slightly imprecise.

Indeed, the suggestion is similar to that in the screenshot above. But after accepting the suggestion, the closing paren and opening and closing braces are added automatically, and the caret is positioned between the braces and even indented properly. Just as if VAX wanted to say "Look, I've done all that stupid boring work for you, go ahead, produce some code!" (Or is this standard behaviour of the IDE? Would surprise me at the very least...)

With one exception: If it's a "const" method, the "const" is not inserted.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Aug 20 2006 :  5:07:58 PM  Show Profile  Reply with Quote
which IDE are you using? i would not expect VA to automatically insert both curly brackets. if you type the open bracket, and have the option to insert closing brackets in VA turned on then the closing bracket should be inserted.

this is really where Create Implementation comes along and does all of the boring work for you. personally i have reached the point where i only ever use Create Implementation when programming, anything else is just to much typing

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

KirillMueller
Ketchup Master

72 Posts

Posted - Aug 20 2006 :  5:18:31 PM  Show Profile  Reply with Quote
Sorry about the fuss. It's me who inserted the curly braces and didn't notice it... But I always forget the const and notice that too late.

Anyway, my point is, that VAX could be made smart enough to add the "const". But I agree that this becomes less important as "Create Implementation" becomes better.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Aug 21 2006 :  6:46:07 PM  Show Profile  Reply with Quote
the basic problem with inserting the const is that VA is saying "lets insert this string here" between the brackets. to add the const makes this noticeably more complex, since you then have to stop and think about curly brackets on the same or next line. then what about comments on the same line...

it is the edge cases that tend to get us.

Create Implementation is not perfect, but it is definitely getting better, and i would suggest this as the best solution for this.

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