Author |
Topic |
|
wstanley
Junior Member
20 Posts |
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; }
|
|
feline
Whole Tomato Software
United Kingdom
19020 Posts |
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 |
zen is the art of being at one with the two'ness |
|
|
KirillMueller
Ketchup Master
72 Posts |
|
wstanley
Junior Member
20 Posts |
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. |
|
|
wstanley
Junior Member
20 Posts |
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 |
|
|
|
Topic |
|
|
|