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: charette@ultoe.det.dec.com (Mark Charette) Subject: Re: may be a little CXX bug on ALPHA in stdarg with float. Date: 1995/10/10 Message-ID: <45dmvl$jul@pms507.pms.ford.com>#1/1 X-Deja-AN: 117333180 distribution: world references: organization: Ford Motor Company -- standard disclainers apply newsgroups: comp.unix.osf.misc Jean-Louis Moser (jlm@ludo.two-oo-one.fr) wrote: : | May be here is a bug in DEC C++ V5.0-3 for DEC OSF/1 (Alpha). : #include : #include : void foo (float a, ...) : { : va_list list; : va_start (list, a); : while (a != 0) { : cout << a << " "; : a = va_arg (list, float); : } : cout << endl; va_end (list); : } : void main () : { : foo (1.0f,2.0f,3.0f,4.0f,0); : } : the result is : 1 (it may be: 1 2 3 4) : when we replace float with short, int, double, or struct A {long x_; long y_;}; : it work fine. There is the same problem with cc and GNU g++. >From Programmer's Quick Reference Series, Standard C (Plauger & Brodie), Page 142 (va_start) The last argument must not have register storage class, and it must have a type that is not changed by the translator. (It cannot have an array type, a function type, type float, or any integer type that changes when promoted). Your va_start does not meet these requirements. -- Mark Charette charette@mika.com MIKA Systems, Inc 17197 N. Laurel Park Dr Suite 115 Livonia, MI 48152