Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)
beliavsky_at_aol.com
Date: 01/17/05
- Next message: James Giles: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Previous message: James Van Buskirk: "Re: PGF90-S-0087-Non-constant expression where constant expression required"
- Next in thread: James Giles: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: James Giles: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: Another Jake: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: Richard Maine: "Re: Redefining a numeric constant in Fortran"
- Reply: Gordon Sande: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: Jim: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: James Parsly: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 16 Jan 2005 18:14:44 -0800
Roy Smith wrote (in comp.lang.python):
>Believe it or not, in some early versions of Fortran, numbers were not
>immutable! I forget the exact scenario, but if you did something like:
> subroutine munge (i)
> i = 3
> return
>and then in your main program did:
> j = 7
> call munge (7)
> write (6, 11) j
> 11 format ('j = ', i6)
>it would print 3! The problem is that numerical constants were
interned
>(i.e. in the main program, there was only a single 7 stored in memory,
>and both uses of 7 referred to the same memory location), and the
value
>passed to the subroutine was call by reference. It was almost as if
the
>compiler let you say "7 = 3" as an assignment statement.
>Needless to say, people did indeed complain massively.
Was this (the ability to redefine the value of '7') ever really true of
Fortran, or a particular Fortran compilers?
- Next message: James Giles: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Previous message: James Van Buskirk: "Re: PGF90-S-0087-Non-constant expression where constant expression required"
- Next in thread: James Giles: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: James Giles: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: Another Jake: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: Richard Maine: "Re: Redefining a numeric constant in Fortran"
- Reply: Gordon Sande: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: Jim: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Reply: James Parsly: "Re: Redefining a numeric constant in Fortran (Was Re: why are some types immutable?)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]