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
 [1738] Implementation wonky with namespaces
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

DocBrownX
New Member

4 Posts

Posted - Dec 13 2009 :  4:40:32 PM  Show Profile  Reply with Quote
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?

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Dec 14 2009 :  2:29:24 PM  Show Profile  Reply with Quote
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.
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