Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8945321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T12:13:13+00:00 2026-06-15T12:13:13+00:00

In Fortran 90, we can overload functions with an interface. However, according to this

  • 0

In Fortran 90, we can overload functions with an interface. However, according to this site, we cannot define these functions with the same arguments name. With gfortran, it does not seem to be a problem as the following code works well enough:

interface check
  module procedure check_int, check_real
end interface

contains 

subroutine check_int(cur, dname, func_name, fname)
  integer, allocatable, intent(in) :: cur(:)
  character(*) :: dname, func_name, fname
  ...
end subroutine

subroutine check_real(cur, dname, func_name, fname)
  real, allocatable, intent(in) :: cur(:)
  character(*) :: dname, func_name, fname
  ...
end subroutine

So, is it bad practice to do so?

Edit: Calling the function with keywords does not change anything.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T12:13:17+00:00Added an answer on June 15, 2026 at 12:13 pm

    Your example is perfectly valid. They can be distinguished by the TYPE of the arguments. The names are not important then. In your case the type of the cur argument differs.

    The arguments with the same name can be distinguished by their type, kind or rank (TKR compatibility).

    The point of the referenced article is that you cannot distinguished two specific procedures only by the ORDER of the arguments. It is because the procedures can be called with the keyword arguments in any order. This can be overcomed by using different names for the arguments.

    Otherwise declaring more specific procedures for a generic one with the same names of arguments, but with different types/kinds/ranks is very common and perfectly valid.

    Fortran 2003/2008 adds some more possibilities to generic resolution. It is also possible to distinguish procedures by the pointer/allocatable attribute of their arguments and by the procedure pointer dummy arguments.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In short, can I do something like this in fortran (any of the fortran
I have this old Fortran executable that can only be accessed through its GUI,
I can not call the same subroutine two time using pgf90 fortran complier on
This situation can only occur without name mangling (I believe), so the below code
I can create function pointers in Fortran 90, with code like real, external ::
I can create and use dynamic two dimensional array in Fortran (in 77 standard).
In fortran, I can declare a character string as: character*80 mystring and then send
I have Fortran-based 3D column-major order array flattened into linear memory. What formula/algorithm can
What does this Fortran code mean: IF (J1-3) 20, 20, 21 21 J1 =
I'm just trying to get a little familiar with Fortran (because I can) so

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.