[J3] sequence type equality

Van Snyder van.snyder at sbcglobal.net
Thu Oct 15 13:54:06 EDT 2020


On Thu, 2020-10-15 at 10:13 -0400, Steve Lionel via J3 wrote:
> The idea of SEQUENCE was that without it, compilers were free to reorder 
> derived type components - I am not aware of any that did. SEQUENCE did 
> not specify whether or not components could have padding added (for data 
> alignment). Some compilers (and many users) assumed that SEQUENCE meant 
> no padding, and some compilers naturally align SEQUENCE type components. 
> It's a mess.
> 
> Indeed, BIND(C) solves the ordering problem. It doesn't completely solve 
> the padding problem, but at least any padding must be consistent with 
> the companion C processor which is what most care about.

I inherited a code that used SEQUENCE to read records from a direct
access file that was not prepared by Fortran. I don't know what program
prepared it. It was important to preserve ordering, and not have
padding. Fortunately, the compilers we used didn't insert padding.
Having padding or alignment to match the companion C processor would
have been unhelpful.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.j3-fortran.org/pipermail/j3/attachments/20201015/7c0910f2/attachment.htm>


More information about the J3 mailing list