[6566] in Athena Bugs

home help back first fref pref prev next nref lref last post

vax 7.1H: C compiler / preprocessor

daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Fri Dec 7 13:10:24 1990

From: ellis@ATHENA.MIT.EDU
To: bugs@ATHENA.MIT.EDU
Date: Fri, 07 Dec 90 13:09:26 EST

System name:		m33-222-6
Type and version:	CVAXSTAR 7.1H
Display type:		SM

What were you trying to do?
Run this program:

#include <stdio.h>
static float w[] = {  1.,2. ,3., 4. };

static float sqrarg; 
#define SQR(a) (sqrarg=(a),sqrarg*sqrarg) 
/* #define SQR(a) ( a*a ) */

main()
{

    float a1,a2,a3,a4;

    a1 = SQR(w[0]);
    a2 = SQR(w[1]);
    a3 = SQR(w[2]);
    a4 = SQR(w[3]);

    printf("%f %f %f %f \n",a1,a2,a3,a4);
    printf("%f %f %f %f \n",SQR(w[0]),SQR(w[1]),SQR(w[2]),SQR(w[3]));
  }


What's wrong:
program should produce identical lines of output. here is actual
output:

1.000000 4.000000 9.000000 16.000000
16.000000 16.000000 16.000000 16.000000


What should have happened:
   both lines should be identical 

Please describe any relevant documentation references:
  ???

home help back first fref pref prev next nref lref last post