improper fortran casting
Brian Taylor
spam.brian.taylor at gmail.com
Thu Mar 12 10:13:36 CDT 2009
The F90 module I sent to the list a while back contained interface
declarations for many of these functions. An interface is the Fortran
90 equivalent of a C function prototype. It will check arguments
based on type, kind, and rank. For example:
interface
function nfmpi_put_att_int(ncid, varid, name, xtype, len, ivals)
include 'mpif.h'
integer, intent(in) :: ncid
integer, intent(in) :: varid
character(len = *), intent(in) :: name
integer, intent(in) :: xtype
integer(MPI_OFFSET_KIND), intent(in) :: len
integer*4, intent(in) :: ivals(*)
integer :: nfmpi_put_att_int
end function
end interface
The compiler will stop with an error if this function is passed an
array "len" of the wrong integer kind (i.e. not MPI_OFFSET_KIND).
These interface declarations don't have to go into a module file,
although that would be the ideal solution. The interfaces could be
declared in "pnetcdf.inc", but it would greatly increase the size of
that file.
Brian
On Tue, Mar 10, 2009 at 3:55 AM, Nils Smeds <nils.smeds at se.ibm.com> wrote:
>
> or inline:
> int(1,kind=MPI_OFFSET)
>
> An alternative short-hand for the above (admittedly ugly, but no worse than
> the corresponding feature in C) is:
>
> 1_MPI_OFFSET
>
> /Nils
>
> ______________________________________________
> Nils Smeds, IBM Deep Computing / World Wide Coordinated Tuning Team
> IT Specialist, Mobile phone: +46-70-793 2639
> Phone: +46-8-793-2639, Fax. +46-8-793 9523
> Mail address: IBM Sweden; Loc. 5-03; 164 92 Stockholm; SWEDEN
>
> Såvida annat inte anges ovan: / Unless stated otherwise above:
> IBM Svenska AB
> Organisationsnummer: 556026-6883
> Adress: 164 92 Stockholm
>
More information about the parallel-netcdf
mailing list