how using va_arg on codewarrior 10.6 for MPC5604B

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

how using va_arg on codewarrior 10.6 for MPC5604B

1,285件の閲覧回数
tengyao
Contributor II

pastedImage_1.pngpastedImage_2.png

3 返答(返信)

1,207件の閲覧回数
martin_kovar
NXP Employee
NXP Employee

Hello,

I used the code below and I am able to compile the project. Please check and let me know, if it works on your side.

#include <stdarg.h>

void printargs(int arg1, ...);

void printargs(int arg1, ...)
{
    va_list ap;
    int i;

      va_start(ap, arg1);
      for (i = arg1; i >= 0; i = va_arg(ap, int))
      {  
      }
      va_end(ap);
 }

int main(void) {
  volatile int i = 0;

  printargs(1, -1);
  /* Loop forever */
  for (;;) {
    i++;
  }
}

Regards,

Martin

1,207件の閲覧回数
tengyao
Contributor II

Hello,

   Thank you for your answer.I According to your demo and Building the project.The compiled results are as follows:

pastedImage_1.png

0 件の賞賛
返信

1,207件の閲覧回数
martin_kovar
NXP Employee
NXP Employee

Hello,

this is strange. Could you please send me your project? Maybe you have different project settings. I need to compare with my project.

Regards,

Martin