ID: Q123093
7.00 | 1.00 1.50 1.51 MS-DOS | WINDOWS kbtool kbdocerr kbbuglist
The information in this article applies to:
- Microsoft C/C++ for MS-DOS, version 7.0
- Microsoft Visual C++ for Windows, versions 1.0, 1.5, and 1.51
When using two underscores with the emit keyword (__emit), the compiler generates error C2400.
error C2400: inline syntax error in 'opcode';found 'constant'
Use only one underscore with _emit.
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
This problem can arise when using the online help example code, which shows how to use two underscores with emit. The online help for emit can only be invoked by pressing the F1 key when either emit or __emit is selected.
The _emit keyword defines a single immediate byte at the current location. The _emit pseudo-instruction is similar to the DB directive of the Microsoft Macro Assembler (MASM). It allows definition of a single immediate byte at the current location in the current code segment. However, _emit can define only one byte at a time, and it can only define bytes in the code (_TEXT) segment. It uses the same syntax as the INT instruction. You can use _emit to define processor specific instructions, which the inline assembler does not support.
The following code sample defines and uses the 80386 CWDE instruction. It demonstrates the compiler error discussed in this article.
/* compile options needed: none.
*/
/* Macro for 386 cwde instruction, assumes 16-bit mode */
#define cwde __asm __emit 0x66 __asm __emit 0x98 /* C2400 */
/* Work-around :
Replace the above macro with the following line:
#define cwde __asm _emit 0x66 __asm _emit 0x98
*/
void main()
{
__asm mov ax, 0xFFFF
cwde ; Macro to generate CWDE
__asm nop ; use Codeview to look at EAX
}
Additional reference words: 7.00 8.00 8.00c 1.00 1.50 1.51 docerr
KBCategory: kbtool kbbuglist kbdocerr
KBSubcategory: AsmIss
Keywords : kb16bitonly
Last Reviewed: July 23, 1997