- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You do have __FILE__ and __LINE__.
While not equivalent to __func__, it is close enough for debugging and error reporting.
Jim Dempsey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page