Microsoft KB Archive/199057

= BUG: Expansion of the __LINE__ macro is incorrect when you use Debug Information for Edit and Continue (/ZI) in Visual C++ =

Article ID: 199057

Article Last Modified on 1/11/2006

-

APPLIES TO


 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition

-



This article was previously published under Q199057



SYMPTOMS
The results of the __LINE__ macro are incorrect when you use Debug Information for Edit and Continue (/ZI). The problem may manifest itself as compiler, linker, or run-time errors.



WORKAROUND
To work around this problem, use the Program Database option (/Zi) instead of Edit and Continue (/ZI).



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the "Applies to" section.



MORE INFORMATION
The following sample code demonstrates the problem. // TEST.CPP - Compile with /GX and /Zi or /ZI. #include using namespace std;

#define CONCAT(s1,s2) #s1 ## #s2 #define MSG(n) cout << CONCAT(Message at line\x20,n) << endl;

int main {  MSG(__LINE__); return 0; } When compiled with the /Zi option, output is correct:

Message at line 12

When compiled with the /ZI option, output is incorrect:

Message at line (__LINE__Var+1)

Keywords: kbhowto kbbug kbpending kbcompiler KB199057

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.