optional argument versus subroutine overloading
- From: "reubendb" <reubendb@xxxxxxxxx>
- Date: 28 Feb 2007 07:42:18 -0800
Hello,
I've encountered some cases where a part of my program can be written
either as
1. optional argument(s), do one thing or another depending on the
presences of certain argument(s),
or ,
2. use subroutine overloading
In some cases (1) seem simple because I don't need to repeat a part of
code, while if doing (2) I need to repeat some part of codes that are
the same for several of the function/subroutine overloading (of course
I can always refactor, but in some cases I feel that too much re-
factoring actually is more confusing if it's beyond some sweet spot).
My concern though, is with performance. Which one perform better, if
this subroutine (either overloaded or using optional argument and do
presence test) is going to be called many times (tens of thousands)
inside a loop ? Is function/subroutine overloading actually resolved
during compilation, or during run time, as in the case of presence
test ?
Thanks for any insight.
RDB
.
- Follow-Ups:
- Re: optional argument versus subroutine overloading
- From: Steve Lionel
- Re: optional argument versus subroutine overloading
- Prev by Date: Re: Matlab -> Fortran
- Next by Date: Re: Array Constructors
- Previous by thread: Fortran Start Page (Reminder)
- Next by thread: Re: optional argument versus subroutine overloading
- Index(es):
Relevant Pages
|
|