- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A quick question. In the following code, using integer*4 for COM works. I tried to change it to a integer kind definition, but could not get it to work. Can someone explain what's going on.
module Kinds
! -- Integer types
integer, parameter, public :: bi_k = SELECTED_INT_KIND(1) ! Byte integer
integer, parameter, public :: si_k = SELECTED_INT_KIND(4) ! Short integer
integer, parameter, public :: li_k = SELECTED_INT_KIND(8) ! Long integer
integer, parameter, private :: ll_t = SELECTED_INT_KIND(16) ! LLong integer
integer, parameter, public :: lli_k = ( ( ( 1 + SIGN( 1, ll_t ) ) / 2 ) * ll_t ) + &
( ( ( 1 - SIGN( 1, ll_t ) ) / 2 ) * li_k )
end module Kinds
program prog
use Kinds, only: si_k
use IFCOM
!--
implicit none
integer*4 :: status ! This works
! The following definition of status does not work.
!integer (kind = si_k) :: status ! This does not work
continue
call COMINITIALIZE (status)
! -- do stuff ...
call COMUNINITIALIZE()
end program prog
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In our implementation, the kind numbers match the bytesize numbers except for COMPLEX, where the kind of the REAL part is used. There exist other implementations which make different choices for KIND numbers. Use SELECTED_INT_KIND and SELECTED_REAL_KIND rather than hard-coding kind numbers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In our implementation, the kind numbers match the bytesize numbers except for COMPLEX, where the kind of the REAL part is used. There exist other implementations which make different choices for KIND numbers. Use SELECTED_INT_KIND and SELECTED_REAL_KIND rather than hard-coding kind numbers.
Steve. Thanks for the clarification. I agree that I have misunderstood some things. I got some ideas froma website.
http://ram3.chem.sunysb.edu/nucwww/helplib/FORTRAN/DATA/CONSTANTS/INTEGER.html
Are the following kinds correctly defined now?
integer, parameter, public :: bi_k = SELECTED_INT_KIND(4) ! Byte integer
integer, parameter, public :: si_k = SELECTED_INT_KIND(9) ! Short integer
integer, parameter, public :: li_k = SELECTED_INT_KIND(15) ! Long integer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page