Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 [1738] Implementation wonky with namespaces

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
DocBrownX Posted - Dec 13 2009 : 4:40:32 PM
When using Create Implementation with methods in a namespace with the following code, the command works as expected.


namespace Yar
{
	void ar();
}


generates:


namespace Yar
{
	void ar();

	//////////////////////////////////////////////////////////////
	// void ar 
	//	In:		
	//	Out:	
	//////////////////////////////////////////////////////////////
	void ar()
	{

	}
}


But when using macros to define the beginning and end of a namespace, code generation gets really wonky.


#define NS namespace Yar {
#define endNS }

NS
void ar();
endNS


will generate:


//////////////////////////////////////////////////////////////////////////
// NS
void Yar::ar 
//	In:		
//	Out:	
//////////////////////////////////////////////////////////////////////
NS
void Yar::ar()
{

}


Note the uncommented line in the function comment block, as well as the namespace being incorrectly identified. The newline between the namespace and the rest of the function declaration breaks commenting when using $SymbolType$. If you take that out of the refactoring snippet, the code generated is this:


#define NS namespace Yar {
#define endNS }

NS
void ar();

//////////////////////////////////////////////////////////////////////
// ar 
//	In:		
//	Out:	
//////////////////////////////////////////////////////////////////////
NS
void ar()
{

}
endNS


Is this intended behavior?
1   L A T E S T    R E P L I E S    (Newest First)
accord Posted - Dec 14 2009 : 2:29:24 PM
I am seeing the same effect here. Thank you for the clear description:

case=36921

VA shouldn't pick up such a macro. The another problem with the comment will not appear if VA won't pick up a macro like this.

On the other hand this is not a trivial problem to solve, since you can cut the source code into slices with macros anywhere. So there are cases where refactoring cannot help. Personally I avoid using macros where it's not necessary. I prefer to write down the code or use VA snippets.

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