This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding UNION/MAP -- Feedback and tips pls!


On Mar 2 2013, Janus Weil wrote:

I have to confess that my first reaction was that we shouldn't be doing STRUCTURE/UNION at all.

We certainly shouldn't be doing STRUCTURE. This is really just the same as TYPE in standard Fortran.

However, UNION looks like a reasonable extension to me (which has no
direct replacement in standard Fortran - unless you count
EQUIVALENCE). I also think we should only support the standard '%' as
a component selector (also with unions).

There are good reasons for Fortran not standardising unions and going for CLASS(*) - unchecked unions are incompatible with strong typing. My vague recollection is that DEC UNION is unchecked, and it certainly allows the preservation of overlaid data, which is equally horrible.

However, I would be content if it lived
behind an option.

Under the above circumstances, I don't really see a problem with enabling it by default (i.e. with -std=gnu) as we do for other extensions.

Unless people start to use it for new code :-(


I guess one could even argue whether having -std=gnu by default is
reasonable at all, or whether the default shouldn't rather be
-std=f2008ts (possibly augmented by -fall-intrinsics) ...

I definitely feel that it should NOT include major gotchas like the abominable Cray pointers. When we were collaborating with Hitachi, they said that they would implement them if I found find a specification. I eventually said that I couldn't :-( I gave up after I found 6 wildly different specifications, with DEC having several - I didn't even try to check which compilers with apparently the same specification behaved similarly. And I have seen a LOT of trouble with that over the decades.

My justification for that rant is that (most) unions are every bit
as bad.  They should NOT be encouraged.


Regards, Nick Maclaren.







Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]