Lane Straatman wrote: (snip) And it was because of "a" being undefined on the second call that I got the runtime. I think the snippet from MR&C makes for a good reference to talk about what does and doesn't get saved, and what that means for a variable in a procedure. I was going ...
...... I tried to find relevant material in the standard (04-007 pg 87, 91), but found nothing. -- Try MR&C, Section 3.3. That helps. It's funny how you just glide over stuff in the beginning of a text, and it becomes important later. As the source snippet stands in 7.3, it will get a runtime error on the second call to it when ...
"Lane Straatman" <invalid@invalid.net> wrote in message news:xICdnTLcJv8uJWTYnZ2dnUVZ_sKunZ2d@comcast.com... I tried to find relevant material in the standard (04-007 pg 87, 91), but found nothing. -- Try MR&C, Section 3.3. Regards, Mike Metcalf
Richard Maine wrote: Lane Straatman <invalid@invalid.net> wrote: The gocha is when it's automatically saved and you don't know, and your background is more C than Fortran. Explicitly saving is documentation. Actually, no that's not a gotcha... well, not in terms of writing correct code anyway. It can be a gotcha in terms of understanding why code is valid. I agree that the...
... in message news:1hv2y2b.vitfhf12sku29N%%nospam@see.signature... Lane Straatman <invalid@invalid.net> wrote: The gocha is when it's automatically saved and you don't know, and your background is more C than Fortran. Explicitly saving is documentation. Actually, no that's not a gotcha... well, not in terms of writing correct code anyway. It can be a gotcha in terms of ...
Lane Straatman <invalid@invalid.net> wrote: The gocha is when it's automatically saved and you don't know, and your background is more C than Fortran. Explicitly saving is documentation. Actually, no that's not a gotcha... well, not in terms of writing correct code anyway. It can be a gotcha in terms of understanding why code is valid. I agree that the explicit save is good ...
..."explicitly save" I simply meant writing that line as integer, save :: counter = 0 even though the "save" doesn't actually do anything. It's pretty much equivalent to your "automatically saved" comment, but shorter. :) The gocha is when it's automatically saved and you don't know, and your background is more C than Fortran. Explicitly saving is documentation. -- LS
... it wouldn't be a brand new counter every time. (?) The counter _is_ saved, just invisibly. You've got it declared like so: integer :: counter = 0 As section 7.5.1 points out, a variable with an initialization in the type declaration statement such as this one automatically gets the "save" attribute, regardless of whether or not it's explicitly specified. ...
... wrong that it wouldn't be a brand new counter every time. (?) The counter _is_ saved, just invisibly. You've got it declared like so: integer :: counter = 0 As section 7.5.1 points out, a variable with an initialization in the type declaration statement such as this one automatically gets the "save" attribute, regardless of whether or not it's explicitly specified. ...
...: "glen herrmannsfeldt" <gah@ugcs.caltech.edu> wrote in message news:5vWdnb0HVeuMHmXYnZ2dneKdnZydnZ2d@comcast.com... Lane Straatman wrote: (snip) Fortran has an assignment statement, unlike C where assignment is an operator and any expression is legal as a statement. Thanks. program fixed1 real :: a integer :: i do i = 1, 5...