|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Variadic functions with mcc18
Has anyone used variadic functions in their FRC code? I want to have a variadic debugging function, but the function appears to get ignored when called. I know the stdarg.h is available and the code compiles, bug I get zero output from the function call (it should do a varying number of printf's, including some for general newlines, which it does not do).
Any thoughts/opinions? If you need to see code, I can probably get a small example of what I want posted. |
|
#2
|
||||
|
||||
|
Re: Variadic functions with mcc18
example would help
![]() |
|
#3
|
|||
|
|||
|
Re: Variadic functions with mcc18
First, add '#include <stdarg.h>' (without quotes at the top of the user_routines.c file).
Code:
void Debug_uchar(unsigned char count,...)
{
va_list ap; /* the list of variables - needed for variadic functions */
unsigned char i; /* counter variable - for loop will iterate through the arguements */
if (num_of_prog_loops == DEBUG_LOOPS)
{
va_start(ap, count); /* we need to initialize the arguement list */
for (i = 0; i < count; i++)
{
printf("%d: %d\n", i, va_arg(ap, unsigned char);
}
printf("\n");
/* num_of_prog_loops is reset at the bottom of ????? routine */
}
va_end(ap);
}
|
|
#4
|
|||||
|
|||||
|
Re: Variadic functions with mcc18
Your printfs will compile but will fail to work if you don't #include <stdio.h>.
|
|
#5
|
|||
|
|||
|
Re: Variadic functions with mcc18
This is in the user_routines.c file, which does have that defined. I'd expect the printf calls to work, since I've used them outside the function in the same source file. It seems that the program doesn't even go into the variadic function.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Known Bug With mcc18 and Wine 0.9.22 | ScottWalls | Programming | 1 | 05-11-2006 15:03 |
| Using MCC18 in a custom program | EHaskins | Programming | 15 | 25-04-2006 23:35 |
| Auton + Functions | ten3brousone | Programming | 0 | 27-02-2005 20:11 |
| Cordic functions... | Zalumaskov | Programming | 1 | 13-02-2005 00:58 |
| subs/functions | maDGag | Programming | 2 | 16-02-2003 23:27 |