Trying to convert fortran to c++ not converting all code

This is not about the stopping and having to continue.

When I have a larger chunk of Fortran code to convert, it will not convert it all, often it will say , ‘here is an outline’ or do something like this:

// …

    // Rest of the loop logic

    // ...
}

}

// Rest of the program logic

// …

Is there anyway to get it to actually convert all the code?

I find that giving ChatGPT to much code at once does at times result in verbal steps and not converted code. What I do find that works is to supply just a function or method at a time and also to give any APIs (think C header) for related functions so that they are not created when the completion is done. It does take some time but it is consistent in converting code from one format to another. Doesn’t guarantee the code will compile but it is often close enough for a skilled programmer of the destination language to easily fix.

Also using a programming language that was relatively small in the training set does not help, if you think Fortran is small you should see the number for Prolog.

See Table 1 of the StarCoder paper.

1 Like

Depending how the code is arranged, like if mostly constructed with functions, you could ask it to convert each function, then afterwards send it the whole thing and tell it that it doesn’t need to re-write all the functions, just change the names since you already converted them.

1 Like

I did tell it to treat all function calls as extern but didn’t help.
I found breaking a long function into small chunks mostly works.