how using va_arg on codewarrior 10.6 for MPC5604B

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how using va_arg on codewarrior 10.6 for MPC5604B

586 Views
tengyao
Contributor II

pastedImage_1.pngpastedImage_2.png

3 Replies

508 Views
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

508 Views
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 Kudos

508 Views
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