Open NeeEoo opened 2 weeks ago
As hello is empty, hello.length - 1
gives -1
, and docs https://haxe.org/manual/std-Array.html says:
If a read access is made on a non-existing index, a target-dependent value is returned. If a write access is made with a negative index, the result is unspecified.
Tested on my machine with latest haxe and hashlink, it gives access violation at https://github.com/HaxeFoundation/haxe/blob/fe0d3e34abb5de658d160eba0b8cc126fab77edc/std/hl/types/ArrayObj.hx#L330 . It does not say what happens when read negative index, but this behavior seems expected.
Looking at the code for ArrayObj.getDyn
it looks like returning null
is the intended behavior, except that comparing UInt
and Int
generates OJSLt instead of OJULt.
@Yuxiao accessing an Array outside its bounds should always return null
Le jeu. 31 oct. 2024 à 12:08, Zeta @.***> a écrit :
Looking at the code for ArrayObj.getDyn it looks like returning null is the intended behavior, except that comparing UInt and Int generates OJSLt instead of OJULt.
— Reply to this email directly, view it on GitHub https://github.com/HaxeFoundation/hashlink/issues/723#issuecomment-2449594972, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQBO575OHULJOA6G25TZ6IFR5AVCNFSM6AAAAABQ2LLAKCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINBZGU4TIOJXGI . You are receiving this because you are subscribed to this thread.Message ID: @.***>
(You're tagging the wrong people xD, there's another yuxiao s on github!) Thank you for the tips, will check!
Unsure if this also happens in base hashlink since theres no mac build for the stable release.
but
haxe version: 4.3.4 hashlink version: 1.14.0