🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #289

gcc-2.2.2: varargs problem?

#289
From: George Lindholm
Date: Fri, 28 Aug 1992 21:53
34 lines
1436 bytes
How do I prototype and define a procedure that takes a variable number of
arguments? When I try the following on our Sun box:
#include <varargs.h>
void test(int a, va_alist);
void test(a, va_alist)
int a;
va_dcl
{
}

I get:
gcc -c a.c
a.c:2: parse error before `__builtin_va_alist'

gcc -E reveals:
void test(int a,  __builtin_va_alist );
void test(a,  __builtin_va_alist )
int a;
   int __builtin_va_alist; ...  
{
}

If I change the prototype to 'void test(int a, ...)' gcc complains that
a.c: In function `test':
a.c:5: number of arguments doesn't match prototype

Any help would be appreciated. Thanks?

   George
-- 
George Lindholm                                  phone:    (604) 822-4375
University Computing Services, UBC               fax:      (604) 822-5116
6356 Agricultural Road, Vancouver, B.C., Canada  internet: lindholm@ucs.ubc.ca
V6T 1Z2                                          bitnet:   USERGNL@UBCMTSG
Technical Details
Message-ID: <1992Aug28.215327.2534@unixg.ubc.ca>
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!gumby!destroyer!ubc-cs!unixg.ubc.ca!ucs.ubc.ca!lindholm

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!yale!gumby!destroyer!ubc-cs!unixg.ubc.ca!ucs.ubc.ca!lindholm
From: lindholm@ucs.ubc.ca (George Lindholm)
Subject: gcc-2.2.2: varargs problem?
Message-ID: <1992Aug28.215327.2534@unixg.ubc.ca>
Sender: news@unixg.ubc.ca (Usenet News Maintenance)
Nntp-Posting-Host: greve.ucs.ubc.ca
Organization: University Computing Services, UBC, Canada
Date: Fri, 28 Aug 1992 21:53:27 GMT
Lines: 34