Thread View: bit.listserv.simula
1 messages
1 total messages
Started by Frans Panken
Tue, 25 Jun 1996 00:00
In reply to your message: value change
Author: Frans Panken
Date: Tue, 25 Jun 1996 00:00
Date: Tue, 25 Jun 1996 00:00
62 lines
2814 bytes
2814 bytes
--------
> Frans Panken writes:
> >
> > Can anyone give me any comments on the following:
> >
> > Suppose a procedure activates a PROCESS CLASS with a local ARRAY "A"
> > as parameter. When after activation of this process class the array
> > "A" is changed within the procedure, the local array in the class
> > that was just activated changes as well !
> > This does not occur in the case of reals, integers, booleans etc.
> >
> > So, if a procedure activates a number (say N) of classes and passes
> > arrays to these classes, the values in the local arrays of classes 1
> > .. N-1 change into the values given to the class which was activated
> > last (i.e. class number N).
> >
> > This observation worries me a bit; are there any other declarations
> > that will change in this manner ??
Ron Kerr writes:
>
> If I understand your question correctly, the changes to the arrays
> occur only if they are transmitted to the classes "by reference", the
> default transmission mode for arrays. (Transmission by reference
> merely passes a pointer and so does not give a copy local to the class
> object.) If you specify the array parameters in the class headings as
> "value", the class objects will have local copies in the same manner
> as reals, integers, etc.
>
> The "value" transmission mode is not available for reference arrays.
>
> Hope that helps.
>
> Cheers....Ron
>
It makes sense that the transmission mode for arrays is "by
reference": it saves a lot of memory.
However, since simula does not explicitely asks you to specify the
mode, because integers, reals etc are called "by value", it
surprised me that it didn't work that way for arrays.
Thanks for your comments, Ron.
Kind regards,
Frans
__o __o
_,\<,_ _,\<,_
(_)/ (_) (_)/ (_)
---------------------------------------------------------------------
Frans Panken UUCP: uunet!cs.kun.nl!fransp
University of Nijmegen, ,==. tel: +31 24 3652450
Computing Science Institute, / @ | e-mail: fransp@cs.kun.nl
Room A-4016,Toernooiveld 1, /_ < fax: +31 24 3553450
NL, 6525 ED Nijmegen =" `g' talk: fransp@eos.cs.kun.nl
---------------------------------------------------------------------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads