From: Martin Str|mberg Subject: Re: stdarg.h problem(s)? Newsgroups: comp.os.msdos.djgpp References: <%kET9.17088$q67 DOT 14211 AT news-binary DOT blueyonder DOT co DOT uk> User-Agent: tin/1.4.4-20000803 ("Vet for the Insane") (UNIX) (SunOS/5.8 (sun4u)) Message-ID: <1042224128.205850@queeg.ludd.luth.se> Cache-Post-Path: queeg.ludd.luth.se!unknown AT brother DOT ludd DOT luth DOT se X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/) Date: 10 Jan 2003 18:42:08 GMT Lines: 72 NNTP-Posting-Host: queeg.ludd.luth.se X-Trace: 1042224128 news.luth.se 26539 130.240.16.109 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com First note that I'm not an expert on va_lists. Edd Dawson 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 : #include : void Warning(char *warningstring, ...) : { : va_list arg_list; : va_start(arg_list, warningstring); : printf("WARNING: "); : printf(warningstring, arg_list); : va_end(arg_list); : return; : } : main() : { : Warning("This is a %s.\n", "test"); : } : //Code ends here : Firstly, I'm pretty sure what i've got there is ok and without error - : although I hope someone will prove me wrong in a way... =) : Well, here's what happens.... : If use the following command line: : gcc test.c -o test.exe : I get zero compilation errors but this is the output when i run the program: How about warnings? Add "-Wall". : WARNING: This is a !_. : or something similar. Ok, well that's the first problem. Second one is when : i use this command line instead: : gpp test.c -o test.exe : (gpp rather than gcc) : I get the following compilation errors: : In file included from test.c:2: : c:/djgpp/lib/gcc-lib/djgpp/3.2/include/stdarg.h:110: conflicting types for ` : typedef char*va_list' : c:/djgpp/include/stdio.h:35: previous declaration as `typedef void*va_list' Have you read the readme file that came in gcc*b.zip. (I don't remember its name but it starts or ends with "readme"). You need to patch the header file, IIRC. : So then I tried renaming c:/djgpp/lib/gcc-lib/djgpp/3.2/include/stdarg.h to : something else for the time being. It then compiled fine, but then same No. You should never rename anything (unless instructed by e. g. a readme to do so)! You're just breaking things. Why is it that people think this is a good idea? I'd sure like to know. Right, MartinS