11-166 To: J3 From: Nick Maclaren Subject: Interop TR: second part of notes on type(*) - example A.1.5 Date: 2011 June 07 Reference: N1854 There has been a great deal of cross-purposes discussion on many aspects that come down to people not closely involved in this group misunderstanding the purpose and intent of type(*). Arising from this, I still think that example A.1.5 is a really, but REALLY, bad idea. Yes, it is possible, but it doesn't even mention the legion of restrictions, 'gotchas' and even ambiguities that it brings in. My main concern is that it will encourage some of the more knuckle-dragging but intelligent programmers to start using it as a way of implementing a form of dynamic EQUIVALENCE (and not just for the Fortran 77 types, either) and - heaven help us! - propagating that view on the Web, in 'bulletin boards' and even in books. But perhaps I am being too cynical .... I propose possible edits, but they are very much a matter of taste. I am also aware that my views are not universally held, but I do feel that this matter needs a proper vote in Garching. I have included two possible options. Bill has said that we might prefer to leave the notes out of the changes to the standard, so that we can provide better ones. That is a trivial change, of course, but is semi-orthogonal to this point. I have included it as a third option, though it can be combined with the others. Edits to N1854: --------------- Option 1: [34:16-44] Delete example A.1.5. Option 2: [34:30+] Append a new paragraph: "This technique should be used only to create a pointer to a Fortran object of the same type as the object that the pointer was created from in the first place, or to create a pointer to a suitable area of memory that was provided by C. Any use for treating the storage of one type of data as if it were another type is undefined in Fortran, usually undefined in C (see the C99 standard, 6.5 paragraph 6 and elsewhere), and will cause chaos under at least some compilers." Option 3: This can be combined with either of the previous options. [28:38-40] and [29:1-2] Delete section 6.10.