From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f678f,e3021afb9c01f15f X-Google-Attributes: gidf678f,public From: dsr@lns598.lns.cornell.edu (Daniel S. Riley) Subject: Re: may be a little CXX bug on ALPHA in stdarg with float. Date: 1995/09/27 Message-ID: #1/1 X-Deja-AN: 110856844 sender: dsr@lns100.lns.cornell.edu references: organization: Wilson Lab, Cornell U., Ithaca, NY 14853 newsgroups: comp.unix.osf.misc In article jlm@ludo.two-oo-one.fr (Jean-Louis Moser) writes: jlm> | May be here is a bug in DEC C++ V5.0-3 for DEC OSF/1 (Alpha). Nope, don't think so. jlm> void foo (float a, ...) jlm> void main () jlm> { jlm> foo (1.0f,2.0f,3.0f,4.0f,0); jlm> } As in C, any argument for which there is no parameter is subject to the usual default promotions, so (regardless of what you may have intended) 2.0f, 3.0f and 4.0f are passed as doubles, not floats. The call should be foo (1.0f,2.0f,3.0f,4.0f,0.0); 0 won't do -- it has to be the length of a double, so an int is too short. The type given to va_arg must be the type after any promotions have been applied, so the values should be retrieved with a = va_arg (list, double); -- Dan Riley Internet: dsr@lns598.lns.cornell.edu Wilson Lab, Cornell University HEPNET/SPAN: lns598::dsr (44630::dsr) "Distance means nothing/To me." -Kate Bush