Skip to main content

Timeline for Simple virtual machine in C

Current License: CC BY-SA 3.0

17 events
when toggle format what by license comment
Jul 7, 2017 at 3:48 vote accept Nergal
Jul 7, 2017 at 3:48 vote accept Nergal
Jul 7, 2017 at 3:48
Jul 1, 2017 at 20:57 history edited Jamal CC BY-SA 3.0
deleted 6 characters in body; edited tags; edited title
Jun 29, 2017 at 6:47 comment added user3629249 when compiling, always enable all the warnings, then fix those warnings. (for gcc, at a minimum use: -Wall -Wextra -pedantic -Wconversion -std=gnu11 )
Jun 29, 2017 at 6:41 comment added user3629249 the function: ftell() returns a long int not a uint64_t
Jun 29, 2017 at 6:36 comment added user3629249 making the enum a typedef is a very poor idea. much better to just define the enum, without an instance Then all the names can still be used
Jun 29, 2017 at 6:34 comment added user3629249 taking the address of a label is non standard, so will not work everywhere and causes the compiler to output a warning message/ This applies to every entry in the dispatch[] array.
Jun 29, 2017 at 6:29 comment added user3629249 exec() is a well known system function, it is very poor programming practice to name your function that same as a system function name.
Jun 29, 2017 at 6:28 comment added user3629249 the code should be checking the returned value from fseek() and from ftell() to assure the operation was successful.
Jun 29, 2017 at 6:25 comment added user3629249 you cannot execute code that is located on the stack. Code has to be in an area where the memory is marked as executable.
Jun 28, 2017 at 13:03 answer added Edward timeline score: 10
Jun 28, 2017 at 11:37 answer added ratchet freak timeline score: 5
Jun 28, 2017 at 7:26 comment added Nergal commented code in main() removed!
Jun 28, 2017 at 7:26 history edited Nergal CC BY-SA 3.0
removing commented out code.
Jun 28, 2017 at 6:53 comment added Nergal having the computed goto feels more clean to me (personal preference) plus it gives me a good excuse to bash the gotophobes. As for the passing code as an argument, I plan to make the VM read a binary file into a buffer, that's why. I'm designing this virtual machine specifically for embedding with a custom scripting language for a game engine I'd like to work on.
Jun 28, 2017 at 6:41 comment added Daerdemandt Why not switch though? If it's for optimisation then you have to compare performances of compiled code (with relevant flags) because compilers get too fancy. (not a C pro, just having read this). Also, why hold the stack globally but pass the code as argument?
Jun 28, 2017 at 4:10 history asked Nergal CC BY-SA 3.0