On Thursday, 17 October 2024 at 02:47:03 UTC, Mai Lapyst wrote:
On Wednesday, 16 October 2024 at 13:10:34 UTC, Mark
Bauermeister wrote:
I think I got every compiler complaint fixed now. However,
upon launch the program immediately quits with "Error Program
exited with code -11". I assume that's a segfault, right?
https://gist.github.com/markusbkk/442a571353a48c5377c503e7d02570fb
Yes, an exitstatus of -11 is an SIGSEGV, like in any other
unix/linux program.
One thing that you might wanna change is your ARRAY_LEN
function: D already supports getting the length of an array
with the `.length` property on arrays. Also the `x.sizeof`
divided through itself will always only yield `1`.
Yea. I forgot about the sizeof division being wrong. I replaced
all calls to ARRAY_LEN with \<array>.length.
No more segfaults thus far but strangely the proper switch case
(https://gist.github.com/markusbkk/442a571353a48c5377c503e7d02570fb#file-dq3vm-d-L1200) is never hit. Instead, it goes straight to the default (https://gist.github.com/markusbkk/442a571353a48c5377c503e7d02570fb#file-dq3vm-d-L1055) even though there's a matching case.
When I `printf("%i", opcode)` inside the default case it
correctly prints "3" which is `goto_OP_ENTER`, so I don't quite
understand why it won't hit the correct branch.
I tried adding the default case to the very bottom of the
switch/case chain too, thinking maybe this is somehow sequential.
But to no avail.