[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gforth] Tutorial - Memory Section - 3 issues

From: Terrence Brannon
Subject: [gforth] Tutorial - Memory Section - 3 issues
Date: Sun, 7 Mar 2010 12:50:28 -0500


Issue One -  CREATE does not push an address onto the stack, yet ALLOT
seems to know where to start allocating cells...

We read:

 create v2 20 cells allot
     v2 20 cells dump
creates a word v2 and reserves 20 uninitialized cells; the address
pushed by v2 points to the start of these 20 cells.

... it says "address pushed by v2" but create does not push an address
(at least not onto the data stack), so how does alloc find the address
that was assigned to v2?

Issue Two - It is a fact that both VARIABLE and CREATE create words
which are simply the address of a memory location.

However, the docs confuse this fact, by stating that VARIABLE creates
global variables while CREATE creates a word.
I dont think it helps a beginner to use the term global variable and
word interchangeably. Because they start thinking there are two
different programmatic constructs when they are not.

Issue Three - How does VARIABLE differ from CREATE?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]