Hi,
Specs:
What is the expected output of the echo in this code:
var bytes = [0x1F.uint8, 0xC2]
bytes = [bytes[1], bytes[0]]
echo bytes
I would expect [0xC2, 0x1F], but it's [0xC2, 0xC2]. Is this expected behaviour?that looks a lot like bug to me. This is the generated C code:
bytes[0] = bytes[(((NI)1))- 0];
bytes[1] = bytes[(((NI)0))- 0];
E.g.
I found this when trying to reverse engineer some code from DOS x86 16-bit assembly, when I got to a line with xchg ah,al, it naturally converted (at least in my eyes) to bytes = [bytes[1], bytes[0]].
Is there a way to make this an error when used?
That should settle your case.
var bytes = [0x1F.uint8, 0xC2]
swap(bytes[1], bytes[0])
echo bytes