(j3.2006) Union in Fortran
Bader, Reinhold
Reinhold.Bader
Tue Sep 13 12:00:51 EDT 2016
See attached code example. Quite clunky, but conforming, I believe.
I think you can do a similar example with BIND(C) types, using the TYPE(*) from TS29113.
Cheers
Reinhold
Von: j3-bounces at mailman.j3-fortran.org [mailto:j3-bounces at mailman.j3-fortran.org] Im Auftrag von Daniel C Chen
Gesendet: Dienstag, 13. September 2016 17:52
An: j3 at mailman.j3-fortran.org
Betreff: (j3.2006) Union in Fortran
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;
Thanks,
Daniel
XL Fortran Development - IBM Toronto Software Lab
Phone: 905-413-3056
Tie: 969-3056
Email: cdchen at ca.ibm.com<mailto:cdchen at ca.ibm.com>
http://www.ibm.com/software/awdtools/fortran/xlfortran
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.j3-fortran.org/pipermail/j3/attachments/20160913/d4fc8542/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: union.tar.gz
Type: application/x-gzip
Size: 1598 bytes
Desc: union.tar.gz
Url : http://mailman.j3-fortran.org/pipermail/j3/attachments/20160913/d4fc8542/attachment-0001.gz
More information about the J3
mailing list