webpage icon indicating copy to clipboard operation
webpage copied to clipboard

Fortran Best Practice: Type Casting in Callbacks

Open awvwgk opened this issue 4 years ago • 2 comments

The chapter Type Casting in Callbacks needs some work.

  1. No links to external gists or pastebin entries, the document must be self-contained
  2. Generally more text actually explaining what is going on in the sections
  3. Better flow of explanation rather than multiple example

awvwgk avatar Sep 05 '21 09:09 awvwgk

The chapter starts by saying

"There are essentially five different ways to do type casting, each with its own advantages and disadvantages.

The methods I, II and V can be used both in C and Fortran. The methods III and IV are only available in Fortran. The method VI is obsolete and should not be used."

If you are going to refer to items by number, you should provide a numbered list. What are the 6 methods? Looking at the headings, I see 7:

  1. Work Arrays
  2. General Structure
  3. Private Module Variables
  4. Nested functions
  5. Using type(c_ptr) Pointer
  6. transfer() Intrinsic Function
  7. Object Oriented Approach

Beliavsky avatar Sep 06 '21 21:09 Beliavsky

Best is to rewrite the whole chapter and focus on a few of the available approaches which we find are best practice. At least we should remove the obsolete methods from this chapter.

awvwgk avatar Sep 07 '21 06:09 awvwgk