This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Function with variable number of arguments.


Alexey,

Thanks for your bug report. Please post original and complete source
the next time (http://egcs.cygnus.com/faq.html#bugreport)

>  int test(char * format,...)
> 

Here is an opening { missing.
> 
>      va_list     marker

Here is a semicolon missing.

>      va_start(marker,format);
>      return  va_arg(marker,int);

According to ISO C, you *must* use va_end.

>  }
>   int i ;
>  rtems_task Init( rtems_task_argument ignored )
> 
> 
> 
>      i  =  test("ABC",0xAA55);
>      exit(0);
>  }
>   I expect to see 0xAA55 in i but recieve 0.

After I corrected these errors, your example works correctly for me on
i486-pc-linux-gnu. 

Perhaps the problem is caused by the cross-compiling environment? Are
you using the correct version of stdarg.h? i.e. the one of the target
environment?

If so, I can't help further: I don't know what target mips64orion is.

Hope this helps,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]