(j3.2006) Union in Fortran

Lionel, Steve steve.lionel
Tue Sep 13 11:58:25 EDT 2016


Daniel Chen wrote:

Hello,

Is there anyway in Fortran that I can do the equivalence of the following C
code?

struct {
  int key;
  union {
    float t;
    int value;
  }
} s;



Not in standard Fortran. There's the old DEC extension UNION/MAP which can
do this. In standard Fortran one would typically use TRANSFER to deal with
such things.

 

Steve Lionel

Intel Developer Support

Merrimack, NH

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20160913/44c0ab4d/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6616 bytes
Desc: not available
Url : http://mailman.j3-fortran.org/pipermail/j3/attachments/20160913/44c0ab4d/attachment.bin 



More information about the J3 mailing list