Structure Pointer ?

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Structure Pointer ?

Post by Comtois »

We have structure for Byte, Long, Quad, Float, String, etc
What about a structure for pointer ?

Code: Select all

Structure Pointer
  *p
EndStructure
Why this ?

I have an array of pointer

Code: Select all

Dim *Array(2,2,2)
And i need to copy this array to another array

Code: Select all

Dim *TempArray(2,2,2)
So i have to write

Code: Select all

  CopyMemory(*Array(), *TempArray(), SizeOf(Pointer) * 27)
May be this structure can be add in resident file ? or may be i'm wrong to do like this ?
Please correct my english
http://purebasic.developpez.com/
User avatar
Rescator
Addict
Addict
Posts: 1769
Joined: Sat Feb 19, 2005 5:05 pm
Location: Norway

Post by Rescator »

Hmm!
Maybe you should request CloneArray() and CloneList() instead?
(creates a exact copy/duplicate of a array or list)

In any case, on 32bit systems *pointer is the same as pointer.l
But a future 64bit compiler may be different so...
*scratches head* might be best to let the PB Team answer this one... I suddenly drew a blank here.
User avatar
Fluid Byte
Addict
Addict
Posts: 2336
Joined: Fri Jul 21, 2006 4:41 am
Location: Berlin, Germany

Post by Fluid Byte »

Dim *Array1(2,2,2)
Dim *Array2(2,2,2)

*Array2() = *Array1()

:?:
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
User avatar
Comtois
Addict
Addict
Posts: 1431
Joined: Tue Aug 19, 2003 11:36 am
Location: Doubs - France

Post by Comtois »

Maybe you should request CloneArray() and CloneList() instead?
(creates a exact copy/duplicate of a array or list)
I dont need this, I can use CopyMemory().
In any case, on 32bit systems *pointer is the same as pointer.l
But a future 64bit compiler may be different so...
Yes it's the reason why i'm asking for something to give the size of a pointer :)

Code: Select all

Dim *Array1(2,2,2)
Dim *Array2(2,2,2)

*Array2() = *Array1()
This code dont work.

I just suggest to add structure pointer in residents, nothing else :)
Please correct my english
http://purebasic.developpez.com/
Post Reply