Re: Problem with my split routine I am not understanding
- From: "Beliavsky" <beliavsky@xxxxxxx>
- Date: 28 Dec 2006 10:30:01 -0800
Jeremy wrote:
I have the following function:
subroutine split(what, by, into)
implicit none
character(len=*), intent(in) :: what, by
character(len=*), dimension(:), intent(out) :: into
integer :: bpos = 1, pos = 1, idx = 1
I have not read your message carefully, but do you realize that the
line above is equivalent to
integer, save :: bpos = 1, pos = 1, idx = 1
and do you know that the SAVE attribute means that the variables are
initialized to 1 only upon the first call of the subroutine and
thereafter preserve their values?
If you do not want the variables to be SAVEd, write instead
integer :: bpos,pos,idx
bpos = 1
pos = 1
idx = 1
Since the Fortran convention is unintuitive to many programmers,
problems with "implicit SAVE" have often come up in this newsgroup --
you can search the archives.
.
- Follow-Ups:
- References:
- Problem with my split routine I am not understanding
- From: Jeremy
- Problem with my split routine I am not understanding
- Prev by Date: Re: Proper way to return a string
- Next by Date: Re: Problem with my split routine I am not understanding
- Previous by thread: Problem with my split routine I am not understanding
- Next by thread: Re: Problem with my split routine I am not understanding
- Index(es):
Relevant Pages
|