Jump to content

About the arrays


Recommended Posts

hmmm,

what i see now is a bit weird

changing the value in the array must not change his address, and futhermore as the references in $a and $b (the array address) have not changed, they should remain equal

like the abc of pointers, i can't see why they would not implement it this way ... :huh:

Edited by 636C65616E
Link to comment
Share on other sites

1 hour ago, 636C65616E said:

what i see now is a bit weird

I think it would be even more weird if after setting $a[0] = 9 to be still equals to $b.   That wouldn't make any sense...

Link to comment
Share on other sites

there's a difference between $a[0] and $a

one is a scalar, the other is a ptr (or something similar for the VM)

hG7fxTO.png

ofc AutoIt doesn't handle array as C type stuff, but it needs memory addressing in the end, so this kind of scheme must exists

Edited by 636C65616E
Link to comment
Share on other sites

Isn't this called copy on write?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

1 hour ago, Nine said:

@JockoDundee  Yes.  See my previous post.

I have, I was just looking to clarify.

What I don't agree with is this:

Quote

A patch has been sent by the devs for approval.  If accepted, comparing $b = $a will return True because memory address would be the same.

The danger is that such a change would be script breaking, since, rightly or wrongly, there is no doubt code out there that depends on the current behavior that would no longer work.

Code hard, but don’t hard code...

Link to comment
Share on other sites

2 hours ago, JockoDundee said:

The danger is that such a change would be script breaking, since, rightly or wrongly, there is no doubt code out there that depends on the current behavior that would no longer work.

What are you talking about ?  Comparing arrays (with = op) was always returning the same result (False) whatever the arrays was, whatever you were comparing.  Unless you were using == which everything was True.  How a more intelligent comparaison would  be script breaking ?

Nobody was using intentionally :

Local $a[] = [1,2,3]
Local $b = $a
While Not ($b = $a)
WEnd

Instead of :

While True
WEnd

If someone was doing it, well I suppose it is time to change their scripts because it was not making much sense...

Link to comment
Share on other sites

I whipped together this example of a custom data type in autoit.  It offers the ability to compare 2 custom arrays bc its just a pointer comparison.  it does offer the ability to create an alias of another.  It is probably correct that this wont offer much in terms of performance gains, simply due to the fact that to dereference any pointer a struct has to be created which is just bananas(that includes any read or write operation).  I'm honestly considering something like this but using a helper c++ program that would allow me to dereference without jumping though all these hoops.  That and any memory operation is going to be 10x faster in c++ compared to autoit anyways so offloading all the heavy lifting would have serious speed benefits. 

asdfwefa.au3

Edited by markyrocks
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...