Mail Archives: djgpp/1996/05/08/16:56:47
> From: Justin Ward <justin AT yoss DOT canweb DOT net>
>
> On Wed, 8 May 1996, Rainer Wank wrote:
>
> > void abc(int anzahl, unsigned char abc, ...)
> > {
> > va_list ap;
> > va_start(ap, abc);
> > fg = va_arg(ap, unsigned char);
> > printf("\n\rErster variabler Parameter: %d", fg);
> > va_end(ap);
> > }
>
> You are taking fg as a char, but printing it as an int. With djgpp, and
> int is 4 bytes and a char is either two or one (I think), depending on
> whether you're compiling as C or C++. On the sun and on bc 3.1, a char
> and an int are both 2 bytes it seems. I can't say for sure regarding the
> sun, but I know this is the case regarding bc. Anyway, just rewrite your
> printf using %c instead of %d and everything will be fine.
No, this is wrong. char is 1 byte in djgpp and it is automatically
converted to int when passed as a parameter.
- Raw text -