Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28612 Discussions

Does Linux ifort or ifx support macros such as __func__


I'm trying to translate some C code to Fortran and the C code has an error routine that uses the __func__ macro to get the current function name. Obviously, I could just pass the function name as a string since I already know it but I have a lot of routines I need to call a Fortran equivalent of the error routine and using something like __func__ willl reduce the amount of typing I will have to do and potential errors. I know there are macros like this for defining if you are on linux etc. I think Fortran 2018 might have added something like this as an intrinsic function but don't quote me on that

0 Kudos
1 Reply
Honored Contributor III

You do have __FILE__ and __LINE__.

While not equivalent to __func__, it is close enough for debugging and error reporting.


Jim Dempsey


0 Kudos