Pointers

Mike Kerner MikeKerner at roadrunner.com
Mon Oct 10 10:36:12 EDT 2016


You can use something similar to pointers going one direction by using
"value", and the other way by using "do".  Those are not full-on pointers,
but it does give you some indirection.  While sometimes it would be nice to
have regular pointer syntax (but in a LC syntax way), at least you can get
close.

Speaking of syntax, I sort-of like 4D's way of dealing with pointers.   a->
is dereferencing a and ->a is left as an exercise for the reader.  However,
the more verbose/english-ish LC way would probably be to use value and come
up with a new keyword for referencing, I suppose, unless we were going to
use "a pointer to" and "what ____ points to", giving us
put a pointer to x into y
put what y points to into z #but, again, i think the current put value(y)
into z works.

On Sun, Oct 9, 2016 at 9:12 PM, JB <sundown at pacifier.com> wrote:

> Livecode has imported foundation which gives users
> the ability to access those libraries and it was written
> you can use pointers.  Pointers are used in both C &
> objective-C.  You write them a little different but the
> basic concept is the same.  A pointer points to a
> location in memory.  A variable is an object which the
> pointer points to.  If variable X holds the integer 34 &
> is located in the memory stack at 4217 the pointer will
> simply hold that address which points you to 4217 in
> memory so you can access and change the contents
> of the memory at 4217 which is the object named X
> and it is a variable of the type int or another type.
>
> To efficiently write code using pointers you need a
> good understanding of them.  Here is a link to one
> of the best tutorials I have seen on pointers;
>
> http://pw1.netcom.com/~tjensen/ptr/pointers.htm
>
> This is written for beginners but it is so good even
> many advanced programmers with a good knowledge
> of pointers will benefit greatly from reading it.
>
> JB
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 
On the first day, God created the heavens and the Earth
On the second day, God created the oceans.
On the third day, God put the animals on hold for a few hours,
   and did a little diving.
And God said, "This is good."



More information about the use-livecode mailing list