Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Auto-complete of implementation fails to add const

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
KirillMueller Posted - Aug 19 2006 : 08:06:49 AM
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.
5   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Aug 21 2006 : 6:46:07 PM
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.
KirillMueller Posted - Aug 20 2006 : 5:18:31 PM
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.
feline Posted - Aug 20 2006 : 5:07:58 PM
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
KirillMueller Posted - Aug 20 2006 : 4:32:05 PM
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.
feline Posted - Aug 20 2006 : 4:24:06 PM
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.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000