Deep Assignment (:=:) 
Author Message
 Deep Assignment (:=:)

If both arrays are exactly the same byte size and element
arrangement, use memcpy() or equivalent.

Quote:

> Hi,
> I had the impression that Deep Assignment (:=:)also worked
> on Arrays but it
> doesn't really, it doesn't work with Arrays both sides and I
> wander
> why not. What's the inconvenience? I remember once it used
> to work. anybody know of another way than a LOOP.

> Thanks
> Greg

--
 Randy Goodhew
 ---[ eQ ]---


Sun, 17 Apr 2005 19:33:43 GMT  
 Deep Assignment (:=:)
It works to initialize all elements

Array :=: 5 !Set all elements to 5

From the help:
If the destination is an array variable that is not part of a GROUP, RECORD,
or QUEUE, and the source is a constant,
variable, or expression, then each element of the destination array is
initialized to the value of the source. This is a
much more efficient method of initializing an array to a specific value than
using a LOOP structure and assigning each
element in turn.

--
Sebastin Streiger
Departamento Sistemas
Red Megatone
Tel: 0342-4502745
Int: 745



Quote:
> Hi,
> I had the impression that Deep Assignment (:=:)also worked
> on Arrays but it
> doesn't really, it doesn't work with Arrays both sides and I
> wander
> why not. What's the inconvenience? I remember once it used
> to work. anybody know of another way than a LOOP.

> Thanks
> Greg



Sun, 17 Apr 2005 22:24:11 GMT  
 Deep Assignment (:=:)
Sorry Randy but what's memcpy()?
Thanks
Greg



Quote:
> If both arrays are exactly the same byte size and element
> arrangement, use memcpy() or equivalent.


> > Hi,
> > I had the impression that Deep Assignment (:=:)also
worked
> > on Arrays but it
> > doesn't really, it doesn't work with Arrays both sides
and I
> > wander
> > why not. What's the inconvenience? I remember once it
used
> > to work. anybody know of another way than a LOOP.

> > Thanks
> > Greg

> --
>  Randy Goodhew
>  ---[ eQ ]---



Sun, 17 Apr 2005 22:32:04 GMT  
 Deep Assignment (:=:)
Unfortunately (or fortunately, depending on who you speak to *grin*) Clarion
does not allow operator overloading, however nothing is stoping you from
writing a function that you can call when you want to do a deep copy between
two or more arrays. How flexible and complete your deep copy is just depends
on how reusable you want it to be, and what you will be storing in the
array.

cheers,

Sean Cameron


Quote:
> Hi,
> I had the impression that Deep Assignment (:=:)also worked
> on Arrays but it
> doesn't really, it doesn't work with Arrays both sides and I
> wander
> why not. What's the inconvenience? I remember once it used
> to work. anybody know of another way than a LOOP.

> Thanks
> Greg



Mon, 18 Apr 2005 16:51:24 GMT  
 Deep Assignment (:=:)
Thanks Sean, I get it.
*grin*
Greg



Quote:
> Unfortunately (or fortunately, depending on who you speak
to *grin*) Clarion
> does not allow operator overloading, however nothing is
stoping you from
> writing a function that you can call when you want to do a
deep copy between
> two or more arrays. How flexible and complete your deep

copy is just depends
Quote:
> on how reusable you want it to be, and what you will be
storing in the
> array.

> cheers,

> Sean Cameron



> > Hi,
> > I had the impression that Deep Assignment (:=:)also
worked
> > on Arrays but it
> > doesn't really, it doesn't work with Arrays both sides
and I
> > wander
> > why not. What's the inconvenience? I remember once it
used
> > to work. anybody know of another way than a LOOP.

> > Thanks
> > Greg



Mon, 18 Apr 2005 18:07:05 GMT  
 Deep Assignment (:=:)
memcpy() is a C function that is available in the Clarion API.

! Clarion API Prototype:

  memcpy(*? destination,*? source,LONG bytes),LONG,RAW,NAME('_memcpy')

It's used to copy data from the source memory location to the
destination memory location.

The easy way to copy two arrays of exactly the same structure
is to enclose them in GROUP structures. This allows simple
assignment, e.g.:

! Data Example - both groups must be the same structure, length, etc.

Grp1    GROUP
Array    LONG,DIM(5)
        END

Grp2    LIKE(Grp1)

! Code Example:

  Grp2 = Grp1 ! now Grp2 contains a copy of all data in Grp1

Quote:

> Sorry Randy but what's memcpy()?
> Thanks
> Greg



> > If both arrays are exactly the same byte size and element
> > arrangement, use memcpy() or equivalent.


> > > Hi,
> > > I had the impression that Deep Assignment (:=:)also
> worked
> > > on Arrays but it
> > > doesn't really, it doesn't work with Arrays both sides
> and I
> > > wander
> > > why not. What's the inconvenience? I remember once it
> used
> > > to work. anybody know of another way than a LOOP.

> > > Thanks
> > > Greg

> > --
> >  Randy Goodhew
> >  ---[ eQ ]---

--
 Randy Goodhew
 ---[ eQ ]---


Mon, 18 Apr 2005 19:47:38 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Deep Assignments - How?

2. deep assignment

3. Deep assignment

4. Has deep assignment changed?

5. ABC newbie: How do I use deep assignment to copy records

6. Deep assignment

7. Deep Assignment

8. Deep Assignment

9. Deep Thoughts by Jack Handey (Req CW15 to run) - deep.zip (2/2)

10. Deep Thoughts by Jack Handey (Req CW15 to run) - deep.zip (1/2)

11. No Assignment in Conditional/PROPOSAL: Assignment expression

12. Dolphin deepCopy, seems deeper than I thought?

 

 
Powered by phpBB® Forum Software