[J3] C_PTR not allowed in SEQUENCE types?

Van Snyder van.snyder at sbcglobal.net
Fri Mar 12 02:12:12 UTC 2021


Many years ago, I inherited a program that used a SEQUENCE type to read
data from a direct-access file that had been written by another
program, probably a C program.
I assume that if anybody wants to fiddle that code again, the SEQUENCE
type ought to be a BIND(C) 	type, right?
On Fri, 2021-03-12 at 09:10 +0900, Malcolm Cohen via J3 wrote:
> Yes, BIND(C) is necessary for interfacing to C (and thus to other
> languages that use C-like interfaces). And MPI is at root a C library
> so one would expect them to be making heavy use of BIND(C).
>  
> So my question would be why is MPI using SEQUENCE and not using
> BIND(C)?
>  
> Perhaps they want derived types in mpif.h? And therefore need
> SEQUENCE to make them the same derived type in every place that
> INCLUDEs it?
>  
> That’s not really a memory layout question (if you want to have the
> same memory layout as C, well that is what BIND(C) is for). But a
> question of an “old fashioned programming style” viz not using those
> new-fangled modules that have only been around for thirty years (more
> than ten years longer than C_PTR).
>  
> Cheers,
> -- 
> ..............Malcolm Cohen, NAG Oxford/Tokyo.
>  
> From: J3 <j3-bounces at mailman.j3-fortran.org> On Behalf Of Bader,
> Reinhold via J3
> Sent: Friday, March 12, 2021 12:02 AM
> To: General J3 interest list <j3 at mailman.j3-fortran.org>
> Cc: Bader, Reinhold <Reinhold.Bader at lrz.de>
> Subject: Re: [J3] C_PTR not allowed in SEQUENCE types?
>  
> 
> Hi Bill, 
> 
> > On a related issue, I'm not really sure why SEQUENCE is not already
> in the list of Obsolescent features. 
> 
> I had a discussion on this recently with Rolf Rabenseifner (from the
> MPI Forum). Sequence types feature prominently in the 
> type API of MPI for the Fortran interface, because the memory layout
> is not sufficiently specified for non-SEQUENCE / non-BIND(C) types. 
> 
> I would assume quite some MPI codes use this, and it would be a
> significant imposition if SEQUENCE were on the way to be 
> removed. 
> 
> Cheers
> Reinhold
> 
> 
> Disclaimer
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
> Please see our Privacy Notice for information on how we process
> personal data and for details of how to stop or limit communications
> from us.
> 
> This e-mail has been scanned for all viruses and malware, and may
> have been automatically archived by Mimecast Ltd, an innovator in
> Software as a Service (SaaS) for business.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20210311/b3064498/attachment.htm>


More information about the J3 mailing list