Problem with #define'd macro...

GORDON KEEGAN c145gmk at utarlg.uta.edu
Thu Mar 21 00:57:16 AEST 1991


Attempting to compile the following (fragment, but displays the problem)
results in an 'invalid target for assignment' error on our VAX running
VMS 5.3-1, using VAX C 3.1-051.  It compiles fine if I remove the division
and multiplication.  Any insight posted or e-mailed would be greatly
appreciated.  (e-mail will be summarized...)


-----------------------  begin code fragment  -----------------------
#define DIV_MOD(d,r,x,y) ( y == 0.0 ? d = 0.0, r = x : d = x/y, r = x - d*y )

main()
{
float a,b;
float remainder;
float quotient;

a = 5, b = 2; DIV_MOD(quotient,remainder,a,b);
printf("DIV_MOD(%f,%f,%f,%f)\n", quotient, remainder, a, b);
}
-----------------------  end code fragment  -------------------------

aTdHvAaNnKcSe

-----------------------------------------------------------------------------
|  Gordon Keegan                    ||   Bitnet  : c145gmk at utarlg           |
|  Systems Programmer               ||   THEnet  : UTARLG::C145GMK          |
|  Academic Computing Services      ||   Internet: c145gmk at utarlg.uta.edu   |
|  University of Texas, Arlington   ||   AT&TNet : 817-273-2208             |
-----------------------------------------------------------------------------



More information about the Comp.lang.c mailing list