Mail Archives: djgpp/2003/01/11/06:15:10
If you remove the stdarg.h file from the
$djdir$/lib/gcc-lib/djgpp/3.21/include directory, you won't get the
compilation errors. There is in fact a stdarg.h file in the $djdir$/include
directory, which gets its va_* from $djdir$/include/sys/djtypes.h, the same
file that $djdir/include/stdio.h gets its va_* from.
Also, it's recommended to make the main function into:
int main (void);
instead of just
main();
Richard Dawe <rich AT phekda DOT freeserve DOT co DOT uk> wrote in message
news:3E1FE7D8 DOT 6490E6C3 AT phekda DOT freeserve DOT co DOT uk...
> 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:
> > >
> > > : file://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 -