4

我想在 parasoft c++ 测试软件中编译和测试一个示例内联嵌入式汇编代码。

源代码 :

#include <stdio.h>
void example()   { int arg1, arg2, add, sub, mul, quo, rem ;

 printf( "Enter two integer numbers : " );
 scanf( "%d%d", &arg1, &arg2 );


 __asm__ ( "addl %%ebx, %%eax;" : "=a" (add) : "a" (arg1) , "b" (arg2) );
 __asm__ ( "subl %%ebx, %%eax;" : "=a" (sub) : "a" (arg1) , "b" (arg2) );
 __asm__ ( "imull %%ebx, %%eax;" : "=a" (mul) : "a" (arg1) , "b" (arg2) );

 __asm__ ( "movl $0x0, %%edx;"
           "movl %2, %%eax;"
           "movl %3, %%ebx;"
            "idivl %%ebx;" : "=a" (quo), "=d" (rem) : "g" (arg1), "g" (arg2) );

 printf( "%d + %d = %d\n", arg1, arg2, add );
 printf( "%d - %d = %d\n", arg1, arg2, sub );
 printf( "%d * %d = %d\n", arg1, arg2, mul );
 printf( "%d / %d = %d\n", arg1, arg2, quo );
 printf( "%d %% %d = %d\n", arg1, arg2, rem );


 }

代码有错误。每个单词的错误是:

The word 'ebx' is not correctly spelled.

我应该怎么办 ?

4

1 回答 1

1

这很可能不是 Parasoft C++test 本身检测到的错误,而是您从 Eclipse CDT IDE(代码编辑器)获得的提示。您可能正在使用 Parasoft C++test 作为 Eclipse 插件。

于 2016-11-06T11:38:28.663 回答