How do C++ compilers actually pass reference parameters?

后端 未结 4 1917
野性不改
野性不改 2020-12-14 09:49

This question came about as a result of some mixed-language programming. I had a Fortran routine I wanted to call from C++ code. Fortran passes all its parameters by referen

4条回答
  •  孤城傲影
    2020-12-14 10:13

    Just to chime in, I believe you are right. I use references for passing parameters to Fortran functions all the time. In my experience, using references or pointers at the Fortran-C++ interface is equivalent. I have tried this using GCC/Gfortran, and Visual Studio/Intel Visual Fortran. It may be compiler dependent, but I think basically all compilers implement references by pointer passing.

提交回复
热议问题