Strange problems with varargs.h
Nastasi
nastasi@dynamica.it
Thu Jun 22 10:26:00 GMT 2000
Hi guys, I need to contruct functions like vfun2 (see below).
Sometimes this functions need to read paremeters too.
Why don't work correctly ??? I need it ! :-)
I like solution gcc-dependent if it is the only way.
Thank's all.
Best regars, Matteo.
----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< -----
#include <stdio.h>
#include <varargs.h>
int vfun(pippo,va_alist)
int pippo;
va_dcl
{
va_list ap;
char *uno;
long due;
va_start(ap);
uno = va_arg(ap, char *);
due = va_arg(ap, long);
va_end(ap);
fprintf(stderr,"Check vfun %d %s %ld\n",pippo,uno,due);
return 1;
}
int vfun2(pippo,va_alist)
int pippo;
va_dcl
{
fprintf(stderr,"Check vfun2\n");
vfun(pippo,va_alist);
return 1;
}
main()
{
char *p = "STRINGA";
long l = 1000000000L;
fprintf(stderr,"Good\n");
vfun(10,p,l);
fprintf(stderr,"Wrong\n");
vfun2(10,p,l);
exit(0);
}
/* END */
----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< ----- 8< -----
--
Matteo Nastasi - Milano - Italy | HomePage: web.tiscalinet.it/nastasi
| ICQ-Numb: 38095675
Sostenere e supportare GNU/Linux ! | E-Mail: nastasiN@SPAMtiscalinet.it
| (togli N e SPAM per l'indir. vero)
More information about the Gcc-help
mailing list