AHK-v2-script-converter icon indicating copy to clipboard operation
AHK-v2-script-converter copied to clipboard

Deref *() disappearence to NumGet

Open dmtr99 opened this issue 2 years ago • 1 comments

Missing the deref conversion to NumGet, maybe converting *( if it is preceded with = , { ... by a fictive function DereferenceV1, so we can convert it with the Function conversion?

I need more examples of converting derefs to be able to understand it.

BytesRead_ += *(&BytesRead + A_Index-1) << 8*(A_Index-1) ;Bytes read in this very DllCall

=>

BytesRead_ += NumGet(BytesRead, A_Index-1, 'UChar') << 8*(A_Index-1) ;Bytes read in this very DllCall

dmtr99 avatar Mar 14 '22 18:03 dmtr99

You lost the * in the first code in your post. It changed the text to italic

But from https://www.autohotkey.com/docs/Variables.htm#Operators:

Dereference (*): *Expression assumes that Expression resolves to a numeric memory address; it retrieves the byte at that address as a number between 0 and 255 (0 is always retrieved if the address is 0; but any other invalid address must be avoided because it might crash the script). However, NumGet() generally performs much better when retrieving binary numbers.

So looking for the open paren might not be sufficient, since it can work with any expression, or even a single var

Probably not easily doable without writing a whole expression parser

mmikeww avatar Mar 15 '22 04:03 mmikeww