www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/08/02:31:57

Date: Wed, 8 May 96 08:24:02 +0200
From: wank AT uebemc DOT siemens DOT de (Rainer Wank)
Message-Id: <9605080624.AA16965@malta>
To: djgpp AT delorie DOT com
Subject: vararg
Cc: wank AT uebemc DOT siemens DOT de

Hi folks,

i don't know much about variable argument lists, so
i read a few in the Kernighan/Ritchie book.
After that i wrote a little program:

#include <stdarg.h>
#include <stdio.h>

unsigned char fg;

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);
}

void main(void)
{

 abc((int) 10, (unsigned char) 10, (unsigned char) 51);
}


I haved compiled it on my 80486 DX 2 with djgpp gcc version 2
(operating system OS/2 2.11). 
When i run the program it always prints 0 to stdout.

I also have compiled the program with BORLAND C++ 3.1 and it
works fine. Furthermore the acc compiler on the sun delivered
a result i expected.

I have searched for help in the given web page
http://www.delorie.com/djgpp/mail-archives/djgpp
but i have not found an answer.

Do you know an answer ?

Thanx a lot !!!


Wank Rainer
e-mail: wank AT ftth DOT uebemc DOT siemens DOT de

- Raw text -


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