- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am working on a complicated fortran code, which uses MPI and calls FFTW3 functions directly.
As FFTW3 manual pdf file says, the integer is replaced by integer(c_intptr_t), the complex becomes complex(c_double_complex). What's the difference between integer type and integer(c_intptr_t) type data (also the difference between complex and complex(c_double_complex) )? Whether I can use integer(c_intptr_t) the same as integer, or vice versa? Moreover, can I pass values to each other?
For example,
integer :: a
integer(c_intptr_t) :: b
a=1
b=a
What's the value and type of b now?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In general, pointers and integers are different kinds of integers and should not be mixed. The distinctions may be based on storage size (i.e., 4, 8, etc. bytes), signed/unsigned (from the C point of view) and the restrictions on what can be done with/to pointers versus integers. The C_INTPTR_T of Fortran is the same as the intptr_t type of C.
Here is a small test program that you can run in your environment to establish storage sizes.
program tst use iso_c_binding integer :: i4 integer(8) :: i8 integer(c_intptr_t) :: ix ! write(*,*)sizeof(i4),sizeof(i8),sizeof(ix) end program
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page