Message-ID: <0c2401c30751$05203c90$0600000a@broadpark.no> From: "Gisle Vanem" To: References: <0ab801c306bf$4dacb430$0600000a AT broadpark DOT no> <3EA26C19 DOT 81D82449 AT acm DOT org> Subject: Re: __builtin_va_list bug? Date: Sun, 20 Apr 2003 17:25:05 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1123 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1123 Reply-To: djgpp AT delorie DOT com "Eric Sosman" said: > > #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. You mean using "va_list" is pre-standard? (it's used in ) That's funny since djgpp uses it all the time. Have a look at e.g. src\libc\ansi\stdio\doprnt.c. > > x = va_arg (arg, char); > > This will be wrong with either or , since > the actual type of the parameter is not `char' but whatever `char' > gets promoted to: `int' on most machines, but perhaps `unsigned int' > on some oddball architectures. You must specify the promoted type, > not the type to which you will later "demote" it. Yes, I know. I use "x = (char) va_arg(arg,int)" to stop gcc complaining. But my question is why the "int $5" is generated. I guess it's meant to generated some trap on some system. But neither djgpp nor MingW have a int 5 handler. --gv