Re[2]: [BLACKBOX] Variable initialization in BlackBox (was: Zlib under BlackBox)

From: Alexander Iljin <"Alexander>
Date: Sun, 05 Oct 2008 20:26:29 +0000

----boundary-LibPST-iamunique-278174200_-_-
Content-type: text/plain

Hello, Douglas!

  I'm sorry I had to send this to your private e-mail, but the list
  seems to block my messages for some reason (yandex.ru?).

DGD> Oleg and the BB community,

DGD> It is my understanding that within a procedure local variables are
DGD> not initialized upon entrance to the procedure. Hence
DGD> c: LONGINT;
DGD> is undefined (random bit settings).

DGD> Is this correct or am I mistaken?

  You are correct.

  It's all in the Language Report (Docu/CP-Lang, search for
  "initialize"):

  6.4 Pointer Types
  
  ... All fields or elements of a newly allocated record or array are
  cleared, which implies that all embedded pointers and procedure
  variables are initialized to NIL.

  (Allocated with NEW, that is.)

  10. Procedure Declarations

  ... Local variables whose types are pointer types or procedure types
  are initialized to NIL before the body of the procedure is executed.

  10.1 Formal Parameters

  ... Like local variables, output parameters of pointer types and
  procedure types are initialized to NIL. Other output parameters must
  be considered as undefined prior to the first assignment in the
  procedure.

  11. Modules

  ... Variables declared in a module are cleared prior to the
  execution of the module body. This implies that all pointer or
  procedure typed variables are initialized to NIL.

  Hence, only the pointer local variables are initialized.

ONC> In systems with automatic garbage collection like Oberon
ONC> and BlackBox, prof.Niklaus Wirth and Juerg Gutknecht have
ONC> came to a conclusion initialize all variables.

  Oh, did they?

ONC> Because, how you look itself undefined pointers with random bit
ONC> settings? Where it pointes and how garbage collector will be
ONC> process its?

  That's true for POINTERs, not all variables (INTEGERs, REALs and
  ARRAYs thereof have nothing to do with GC).

ONC> And so there was accepted decision to set all new pointers to NIL.
ONC> The situation with numercial variables not so unambiguous, and
ONC> better assign its obviously (additionally so more transparent),
ONC> but I faith that initialization variable in 0 has more advantage
ONC> and value, than in random bit simply.

  It takes time to initialize everything. If they were to take the
  decision you (Oleg) are imposing on Wirth et al, then calling a
  procedure (e.g. in a loop) could become too expensive in terms of
  execution speed, with hardly any benefits.

---=====---
 Alexander




----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-278174200_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTFcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIEhlbGxvLCBEb3VnbGFzIVxwYXINClxwYXINCiAg
SSdtIHNvcnJ5IEkgaGFkIHRvIHNlbmQgdGhpcyB0byB5b3VyIHByaXZhdGUgZS1tYWlsLCBidXQg
dGhlIGxpc3RccGFyDQogIHNlZW1zIHRvIGJsb2NrIG15IG1lc3NhZ2VzIGZvciBzb21lIHJlYXNv
biAoeWFuZGV4LnJ1PykuXHBhcg0KXHBhcg0KREdEPiBPbGVnIGFuZCB0aGUgQkIgY29tbXVuaXR5
LFxwYXINClxwYXINCkRHRD4gSXQgaXMgbXkgdW5kZXJzdGFuZGluZyB0aGF0IHdpdGhpbiBhIHBy
b2NlZHVyZSBsb2NhbCB2YXJpYWJsZXMgYXJlXHBhcg0KREdEPiBub3QgaW5pdGlhbGl6ZWQgdXBv
biBlbnRyYW5jZSB0byB0aGUgcHJvY2VkdXJlLiAgSGVuY2VccGFyDQpER0Q+ICAgYzogTE9OR0lO
VDtccGFyDQpER0Q+IGlzIHVuZGVmaW5lZCAocmFuZG9tIGJpdCBzZXR0aW5ncykuXHBhcg0KXHBh
cg0KREdE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XHBhcg0KIEFsZXhh
bmRlclxwYXINClxwYXINClxwYXINClxwYXINClxwYXINCi0tLS1ccGFyDQpUbyB1bnN1YnNjcmli
ZSwgc2VuZCBhIG1lc3NhZ2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNLQk9YIiB0byBMSVNUU0VS
VkBMSVNUUy5PQkVST04uQ0h9fQARUAum
----boundary-LibPST-iamunique-278174200_-_---
Received on Sun Oct 05 2008 - 22:26:29 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:53 UTC