Re: Preprocessing the arguments of a MACRO function ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Waroquiers <david.waroquiers@xxxxxxxxx> writes:

> In the code, if I have for example :
>
> integer ndim=2
> MY_ALLOCATE(array1(3,-2:4,ndim)) 
>
> /* Here I put "strange" dimensions but that, in principle could happen.
> The -2:4 is to specify in f90 the indices that this array should have,
> if no indices are given (no semicolon), the indices are from 1 to N
> (i.e. 1 to 3 for the first dimension and 1 to ndim for the third one)*/
>
> It should correspond to :
> allocate(array1(3,-2:4,ndim))
> call foo(array1)

You can't do it precisely like that, but you can do this:

#define MY_ALLOCATE(A, B) \
  allocate(A B) \
  call foo(A)

integer ndim=2
MY_ALLOCATE(array1, (3,-2:4,ndim)) 

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux