Mail Archives: djgpp/2003/01/10/13:45:14.1
First note that I'm not an expert on va_lists.
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;
: }
: 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
- Raw text -