PRB: C4093 Caused by MASM-Style Comments in _asm Code

ID Number: Q66310

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.00a buglist6.00ax fixlist7.00

Summary:

SYMPTOMS

When compiling with Microsoft C version 6.0, 6.0a, or 6.0ax,

a warning message will be generated if a section of code is removed

with the preprocessor (#if, #ifdef, and so on) and a constant spans

two lines or is not completed. The error is as follows:

warning C4093: Unescaped NewLine in Character Constant in Inactive Code

See the sample code further below for examples.

RESOLUTION

There following are two workarounds:

- Do not use MASM-style comments. If C-style comments (// or /*

*/) are used instead, the error is not generated.

-or-

- Add the closing quotation mark to the line.

STATUS

Microsoft has confirmed this to be a problem in C versions 6.0,

6.0a, and 6.0ax. This problem was corrected in C/C++ version 7.0.

More Information:

Sample Code

-----------

/* Compile options needed: /W3

*/

void main(void)

{

#ifdef var

printf("This is an error\n );

#endif

}

However, the C4093 error can also occur in a MASM-style comment to an

inline assembler instruction. For instance:

void main(void)

{

#ifdef var

_asm mov ax, 10 ; "Set return code

#endif

}

In this case, if the code had not been inactive, the line would not

have been flagged.

Additional reference words: 6.00 6.00a 6.00ax