From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Martin v. Loewis" To: ekoontz@lsi.sel.sony.com Cc: egcs-bugs@cygnus.com Subject: Re: bug report Date: Sat, 30 Jan 1999 02:26:00 -0000 Message-id: <199901301022.LAA04441@mira.isdn.cs.tu-berlin.de> References: <36B24B4C.B6B0931E@lsi.sel.sony.com> X-SW-Source: 1999-01/msg00776.html List-Id: > Please let me know if you need information about this bug report. In your logfile, you don't explain what the bug is. The program you provide compiles, links, and runs successfully. I assume you are not happy with the result. You wrote void test_func(int args, ...) { va_list ap; va_start(ap, args); printf("number is: %f\n",va_arg(ap,float)); va_end(ap); } There is a bug in this function; float arguments are promoted to double when passed through an ellipsis. Here is the full text from the C Committee Draft on this matter (from 6.5.2.2) >> If the expression that denotes the called function has a type that >> does not include a prototype, the integer promotions are performed >> on each argument, and arguments that have type float are promoted >> to double. These are called the default argument promotions. ... >> If the expression that denotes the called function has a type that >> does include a prototype, the arguments are implicitly converted, >> as if by assignment, to the types of the corresponding parameters, >> taking the type of each parameter to be the unqualified version of >> its declared type. The ellipsis notation in a function prototype >> declarator causes argument type conversion to stop after the last >> declared parameter. The default argument promotions are performed >> on trailing arguments. Hope this helps, Martin