Problem compiling #define ... with pgi C++ compiler

Dear readers of this list, perhaps, this problem has been treated before, but I could not find something related:

when I try to compiler something like

#define INVERSE_TRANSFORMATION(n,x,local,Jinv,Jdet)
{ DOUBLE_VECTOR J[DIM];
TRANSFORMATION((n),(x),(local),J);
M_DIM_INVERT(J,(Jinv),(Jdet)); }

with PG C++ compiler, there is an error message like:

whitney.c", line 104: error: return value type does not match the function
type
INVERSE_TRANSFORMATION(ncoe,CornerCoords, (DOUBLE*)NULL, Jinv, Jdet);
^

However, I need to run pgCC on this and can not change the functions.

Is there any possibility to allow pgCC to process this, such as e.g.
-fpermissive in GCC, which compiles this without complaint ???

Thanks for any feedback! Benedikt Oswald

Hi,

I assume you want to compile, not just preprocess? I preproces it and it works OK.

Can you post a preprocessed code and the whole line or statement of line 104. I would like to see how you put INVERSE_TRANSFORMATION on that line? Hopefully you don’t assign it to variable. If you do, then transformation must be a function return some value and you will need to adjust your macro accordingly. What is the purpose of this macro, to assign TRANSFORMATION to variable?

Hongyon

Hi hongyon, the source code in whitney.c looks like this:

crc0[0] = XC(MYVERTEX(CORNER(t,i)));
crc0[1] = YC(MYVERTEX(CORNER(t,i)));
crc0[2] = ZC(MYVERTEX(CORNER(t,i)));

crc1[0] = XC(MYVERTEX(CORNER(t,j)));
crc1[1] = YC(MYVERTEX(CORNER(t,j)));
crc1[2] = ZC(MYVERTEX(CORNER(t,j)));

evec[0] = crc1[0]-crc0[0];
evec[1] = crc1[1]-crc0[1];
evec[2] = crc1[2]-crc0[2];

VECLEN3D(el,evec);

CORNER_COORDINATES(t,ncoe,CornerCoords);
INVERSE_TRANSFORMATION(ncoe,CornerCoords, (DOUBLE*)NULL, Jinv, Jdet);

W0_0 = GN(DIM+1,i,localcoord);
D_GN(ncoe,i,(DOUBLE*)NULL, GradHatW0);
MM_TIMES_V_DIM(Jinv,GradHatW0,GradW0_);

W0_1 = GN(DIM+1,j,localcoord);
D_GN(ncoe,j,(DOUBLE*)NULL, GradHatW0);
MM_TIMES_V_DIM(Jinv,GradHatW0,GradW0[j]);

/* scale all three components of whitney function of 1st kind /
for(d=0;d<DIM;d++){
w1[d] = el
((W0_0 * GradW0[j][d])-(W0_1 * GradW0[d]));
}


Is this helful ?
Best, Benedikt_

Hi,

I can’t really tell. Is it possible for you to send the preprocessed file(compile with -E) and send to trs@pgroup.com.

Is this application publicly available for download?

Thank you,
Hongyon