delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2003/01/11/06:15:10

From: "Ben Peddell" <killer DOT lightspeed AT bigpond DOT com>
Newsgroups: comp.os.msdos.djgpp
References: <%kET9.17088$q67 DOT 14211 AT news-binary DOT blueyonder DOT co DOT uk> <1042224128 DOT 205850 AT queeg DOT ludd DOT luth DOT se> <0oNT9.5250$CZ5 DOT 4796 AT news-binary DOT blueyonder DOT co DOT uk> <3E1FE7D8 DOT 6490E6C3 AT phekda DOT freeserve DOT co DOT uk>
Subject: Re: stdarg.h problem(s)?
Lines: 75
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
Message-ID: <1JST9.21169$jM5.57907@newsfeeds.bigpond.com>
Date: Sat, 11 Jan 2003 21:04:43 +1000
NNTP-Posting-Host: 144.139.175.57
X-Trace: newsfeeds.bigpond.com 1042282429 144.139.175.57 (Sat, 11 Jan 2003 21:53:49 EST)
NNTP-Posting-Date: Sat, 11 Jan 2003 21:53:49 EST
Organization: Telstra BigPond Internet Services (http://www.bigpond.com)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019