# Fortran for C++ programmers ... guidelines?

**URL:** <https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193>\
**Category:** Uncategorized\
**Created:** [July 6, 2020, 3:20pm UTC](https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193 "2020-07-06T15:20:25Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [July 6, 2020, 3:20pm UTC](https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193/1 "2020-07-06T15:20:25Z")

</div>

During the FortranCon 2020 conference last week someone raised the question whether there is any resource out there that can help C++ programmers get acquainted with Fortran. Guidelines are available for various combinations of programming languages, but none it seems for this particular direction.

Does anyone know of such a guide? If not, I suggest it could be a nice contribution to the fortran-lang tutorials.

Regards,

Arjen

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [July 6, 2020, 4:05pm UTC](https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193/2 "2020-07-06T16:05:03Z")

</div>

I think we should have a guide for Python programmers, e.g., along this:

[https://www.fortran90.org/src/rosetta.html](https://www.fortran90.org/src/rosetta.html)

and we should have a similar guide for C++ programmers. Showing familiar constructs in C++, and how to do them in Fortran.

---

<div class="post-metadata">

**Author:** ![lkedward](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/lkedward/32/72_2.png) [@lkedward](https://fortran-lang.discourse.group/u/lkedward)\
**Post date:** [July 6, 2020, 5:12pm UTC](https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193/3 "2020-07-06T17:12:45Z")

</div>

There’s a fairly comprehensive document in the new flang docs directory: [fortran for c programmers](https://github.com/llvm/llvm-project/blob/master/flang/documentation/FortranForCProgrammers.md) which compares high-level terminology and concepts.

This is something I am hoping to be able to bring to fortran-lang learn section.

---

<div class="post-metadata">

**Author:** ![certik](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/certik/32/4_2.png) [@certik](https://fortran-lang.discourse.group/u/certik)\
**Post date:** [July 6, 2020, 5:54pm UTC](https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193/4 "2020-07-06T17:54:31Z")

</div>

@lkedward that document is a good start. I was hoping to have lots of code side by side examples. At least for me examples are the most helpful.

---

<div class="post-metadata">

**Author:** ![lkedward](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/lkedward/32/72_2.png) [@lkedward](https://fortran-lang.discourse.group/u/lkedward)\
**Post date:** [July 6, 2020, 7:07pm UTC](https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193/5 "2020-07-06T19:07:44Z")

</div>

I haven’t come across any existing Fortran-C++ Rosetta stones but, like your Python effort, this is certainly something we should put together.

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [July 27, 2020, 10:11am UTC](https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193/6 "2020-07-27T10:11:15Z")

</div>

I have mailed with Gary Klimowicz, one of the authors of the flang page, and he agreed that we use the ideas written there to set up such a guide. Together with the examples from the rosetta page, that should do the trick.

---

<div class="post-metadata">

**Author:** ![ivanpribec](https://yyz2.discourse-cdn.com/free1/user_avatar/fortran-lang.discourse.group/ivanpribec/32/3290_2.png) [@ivanpribec](https://fortran-lang.discourse.group/u/ivanpribec)\
**Post date:** [July 27, 2020, 4:21pm UTC](https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193/7 "2020-07-27T16:21:13Z")

</div>

I know of an opposite guide: [C++ for Fortran Programmers](https://users.soe.ucsc.edu/~pohl/fortran.html). There is also book on [C for Fortran Programmers](https://books.google.de/books?id=TDEUert0ZgUC&printsec=frontcover&source=gbs_atb&redir_esc=y#v=onepage&q&f=false). Both are pre-F2003, meaning OO features and C interoperability where not yet part of the Fortran standard.

There is also lecture by Kevin Cowtan on [C++ for Fortran Programmers](http://www.ysbl.york.ac.uk/~cowtan/lectures/kdc05cplusplus.pdf) with side-by-side examples of language constructs.

The FeatFlow finite element package also has an [Overview about Fortran 90/95 for C/C++ programmers](http://www.featflow.de/en/software/featflow2/tutorial/tutorial_lang.html).

---

<div class="post-metadata">

**Author:** ![Arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@Arjen](https://fortran-lang.discourse.group/u/Arjen)\
**Post date:** [July 28, 2020, 6:48am UTC](https://fortran-lang.discourse.group/t/fortran-for-c-programmers-guidelines/193/8 "2020-07-28T06:48:46Z")

</div>

Ivan, thanks for these pointers - I will look into this material.

Regards,

Arjen
