Preprocessing the arguments of a MACRO function ?
David Waroquiers
david.waroquiers@gmail.com
Mon Aug 29 08:14:00 GMT 2011
Hello,
I would like to make a macro MY_ALLOCATE(myarray) where myarray will
be something like arr(dim1,dim2,...,dimN). The MY_ALLOCATE should be
replaced by 2 lines :
1) allocate(myarray) /* with my array being for example
arr(dim1,dim2,...,dimN) */
2) call to another function like : foo(arr) /* where arr is myarray
but without the dim1 .... */
Example :
ndim = 3;
MY_ALLOCATE(array(ndim,3,12))
would be changed to :
allocate(array(ndim,3,12))
call foo(array)
I have tried this :
#define MY_ALLOCATE(myarray(myshape)) allocate(myarray(myshape)) \
call foo(myarray)
But it does not work :/
I do not want to have something like MY_ALLOCATE(myarray,myshape), the
argument list needs to be exactly like in the allocate call.
Any ideas ?
Thanks a lot !
David
More information about the Gcc-help
mailing list