how using va_arg on codewarrior 10.6 for MPC5604B

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

how using va_arg on codewarrior 10.6 for MPC5604B

1,304 次查看
tengyao
Contributor II

pastedImage_1.pngpastedImage_2.png

3 回复数

1,226 次查看
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,226 次查看
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,226 次查看
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