From: Richard Dawe Newsgroups: comp.os.msdos.djgpp Subject: Re: __builtin_va_list bug? Date: Sun, 20 Apr 2003 16:12:17 +0100 Lines: 48 Message-ID: <3EA2B8D1.643143D4@phekda.freeserve.co.uk> References: <0ab801c306bf$4dacb430$0600000a AT broadpark DOT no> <3EA26C19 DOT 81D82449 AT acm DOT org> NNTP-Posting-Host: 62.136.14.148 Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: newsg2.svr.pol.co.uk 1050858147 11481 62.136.14.148 (20 Apr 2003 17:02:27 GMT) NNTP-Posting-Date: 20 Apr 2003 17:02:27 GMT X-Complaints-To: abuse AT theplanet DOT net X-Mailer: Mozilla 4.77 [en] (X11; U; Linux 2.2.23 i586) X-Accept-Language: de,fr To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hello. Eric Sosman wrote: > > Gisle Vanem wrote: > > > > I'm porting some code from Watcom to gcc/djgpp and encountered > > tons of warnings on illegal use of va_arg(). So I cooked up a little > > test: > > > > #include > > char x; > > void foo (va_list arg) > > Hold on; stop right there. You've included , but you're > using the argument list declaration from the pre-Standard > (or with some compilers). The two are not the same, they > are not interchangeable, and they are *definitely* not miscible. [snip] Are you sure that's happening? What if some function calls foo like this: void myfunc (int someval, ...) { va_list arg; va_start(arg, someval); foo(arg); va_end(arg); } I think this is legal according to the C99 standard. From section 7.15 "Variable arguments ": "The object ap may be passed as an argument to another function; if that function invokes the va_arg macro with parameter ap, the value of ap in the calling function is indeterminate and shall be passed to the va_end macro prior to any further reference to ap." ap is the va_list - i.e.: arg in the function myfunc above. Regards, -- Richard Dawe [ http://www.phekda.freeserve.co.uk/richdawe/ ]