(j3.2006) Should character strings be interoperable with char arrays?

Jim Xia jimxia
Tue Jul 24 21:21:03 EDT 2007


Aleksandar Donev <donev1 at llnl.gov> 
Sent by: j3-bounces at j3-fortran.org
07/24/2007 03:00 PM
Please respond to
fortran standards email list for J3 <j3 at j3-fortran.org>


To
fortran standards email list for J3 <j3 at j3-fortran.org>
cc

Subject
Re: (j3.2006) Should character strings be interoperable with char arrays?






I still believe that "pass by address" should be easier to do than C_LOC 
provides (requiring making contiguous copies with TARGET attribute). It is 

easy for the most common cases, but often one is forced to use TYPE(C_PTR) 

and C_LOC. I do not see a way how to write a user function that would help 
me 
pass by address easily: If I have to make a contiguous copy where is it 
going 
to be deallocated? For normal argument passing we have the compiler do all 

that for us.

Aleks


The main difficulty in your program is that in FORTRAN there is no such 
concept as "array of pointers" which C programmers are so used to.  The 
declaration such as "char * p[ ]" in C cannot be represented by anything 
other than array of TYPE(C_PTR) in FORTRAN.  So this is a fundamental 
difference and I can't see how "pass-by-address" calling convention can 
help you in this case.

Cheers,

Jim Xia

XL Fortran Compiler Testing
IBM Toronto Lab at 8200 Warden Ave.
Phone (905) 413-3444  Tie-line 969-3444
D2/NAH/8200 /MKM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://j3-fortran.org/pipermail/j3/attachments/20070724/ad4ad85e/attachment.html 



More information about the J3 mailing list