Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 1539: Macros cause VA to loose context

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
wstanley Posted - Oct 18 2006 : 01:53:21 AM
Using VC++ 2005 and the latest version of VA, symbols are not recognized in test2 after testMac10.
Found this while using a library that we have purchased that uses macros with a large number of parameters.
Just copy the following to see...

// number of params on the macro do not matter,
// number of parameters when used it was matter for the problem
#define testMac9(p1,p2,p3,p4,p5,p6,p7,p8,p9) 0
#define testMac10(p1,p2,p3,p4,p5,p6,p7,p8,p9,p10) 0

// this method works
int test1()
{
const int iA = 2;
cout << iA;
// symbols after the next line are still recognized
int iError = testMac9(1, 2, 3, 4, 5, 6, 7, 8, 9);
return iA + iError;
}

// this method looses it symbol context after after testMac10
int test2()
{
const int iA = 2;
cout << iA;
// symbols after the next line are NOT recognized
int iError = testMac10(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
return iA + iError;
}

//new context, it is alright again
int test3()
{
const int iA = 2;
cout << iA;
int iError = testMac9(1, 2, 3, 4, 5, 6, 7, 8, 9);
return iA + iError;
}

//recognized methods do not seem to have the same problem (at the same limit anyway)
int testMethod(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8, int p9, int p10);
int test4()
{
const int iA = 2;
cout << iA;
int iError = testMethod(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);
return iA + iError;
}
4   L A T E S T    R E P L I E S    (Newest First)
wstanley Posted - Feb 25 2007 : 6:09:06 PM
Just grabbed the new build (1548), and the macros no longer cause any problems. No more workarounds for this issue required.

Thank you
wstanley Posted - Feb 18 2007 : 9:41:44 PM
I have been using a different work around, but it may not be practical for you. The macros I have had issues with are the documented API of a library I am using, but the parts of the API that are affected are quite limited, so where I need to use them, I just wrap the call up in its own very small method. That way the loss of context does not affect very much.
KirillMueller Posted - Feb 18 2007 : 6:01:08 PM
Check out http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=5929 for a possible workaround.
feline Posted - Oct 18 2006 : 09:32:26 AM
Thank you for the very clear example I am seeing exactly the same effect here

case=3105

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