Mail Archives: djgpp/2003/01/11/05:45:14
Hello.
Edd Dawson wrote:
[snip]
> > Edd Dawson <hotcakes AT planetquake DOT com> wrote:
> > : I am currently running into problems when making functions of an
> arbitrary
> > : number of arguments in C/C++.
> > : I am using DJGPP version 3.2. Here's a reduced version of the code I'm
> > : trying to work with:
> >
> > : //Code starts here: test.c
> > : #include <stdio.h>
> > : #include <stdarg.h>
> >
> > : void Warning(char *warningstring, ...)
> > : {
> > : va_list arg_list;
> > : va_start(arg_list, warningstring);
> > : printf("WARNING: ");
> > : printf(warningstring, arg_list);
> > : va_end(arg_list);
> > : return;
> > : }
Try using vprintf instead. Instead of using:
printf(warningstring, arg_list);
use:
vprintf(warningstring, arg_list);
Apart from that, the code looks fine. (I haven't tried compiling it.) You may
want to look at this info page, if you want gcc to produce printf-style format
warnings:
info gcc 'c extensions' 'function attributes'
[snip]
> I think I'll try deleting DJGPP and reinstalling from scratch as I may have
> missed something when trying to remove everything from my system last time
> around.
I don't think you need to go that far. Try reinstalling djdev203. A refreshed
version of that was released, which should fix the problem above.
> Regardless, my code appears to be incorrect. Can anyone help?
Hope that helps. Regards,
--
Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]
- Raw text -