(j3.2006) kind conversion for intent(in), value dummy arguments

Jim Xia jimxia
Mon Sep 15 23:07:17 EDT 2008


j3-bounces at j3-fortran.org wrote on 09/15/2008 07:27:29 PM:

 
> Aleksandar Donev wrote:
> > On Monday 15 September 2008 16:17, Bill Long wrote:
> > 
> > What Craig is taking about is the case when default integer and C_INT 
are 
> > different (e.g., -i8). Then the existing MPI interface passes default 
> > integers even though the underlying implementation wants C ints. So 
you 
> > either need wrappers or you need to change the interface (and thus 
codes).
> > Aleks
> > 
> 
> Or, the user needs to explicitly specify the kinds for the arguments, 
> overriding the effect of -i8.  This is the usual and recommended 
> solution for this problem.  Since the interface is explicit, failure to 
> do this will give error messages that 'remind' the user to fix the 
problem.
> 

In C's calling-by-value convention, there is an implicit conversion on the 
caller site to match the explicit interface.  So even the user uses a 
different kind value (say int vs long long int), the compiler makes sure 
on the caller site, the conversion happens.  This is a quite useful 
feature in C that lacks in Fortran's VALUE attribute.  We may consider to 
add this to Fortran C-interop TR.

Cheers,

Jim Xia

RL Fortran Compiler Test
IBM Toronto Lab at 8200 Warden Ave, Markham, On, L6G 1C7
Phone (905) 413-3444  Tie-line 313-3444
email: jimxia at ca.ibm.com
D2/YF7/8200 /MKM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20080915/86a642fe/attachment.html 



More information about the J3 mailing list