The definition of '&&':
Return the first falsy value, or the last value, skipping the evaluation of other operands.
The definition of '||':
Return the first truthy value, or the last value, skipping the evaluation of other operands.
Toy now follows these definitions.
Fixed#154
By leaving 'null' on the stack, it won't cause stack underflows in a
bunch of erroneous situations. This will allow the repl (and other
situations) to continue if they want to.
I've also fixed some error messages in toy_table.c, which were formatted
badly.
Closes#162
The results can be found in
'tests/benchmarks/array_allocation/results.md'
The results are disappointing, as 'malloc()' is simply faster in every
possible situation compared to my custom arena allocator.
Toy now fits into the C spec.
Fixed#158
Addendum: MacOS test caught an error:
error: a function declaration without a prototype is deprecated in all versions of C
That took 3 attempts to fix correctly.
Addendum: 'No new line at the end of file' are you shitting me?
I attempted to add '-Wpedantic' to CFLAGS, but it seems that my usage of
the variable length arrays within unions is causing an error that can't
be selectively disabled:
error: invalid use of structure with flexible array member [-Werror=pedantic]
This is the offending code: /source/toy_string.h#L9-L37
It seems that tagged unions, with VLAs within, is simply not allowed.
Unfortunately, my whole string system depends on it. I'll have to find some way
around it.
I've also updated the debugging output in repl/main.c.
Getting the array's length is still not available yet, so I'm not
marking arrays as done - but everything that is there is tested.
I've also tweaked the assert output callbacks to also print 'assert failure'.
I added reference values in 62ca7a1fb7,
but forgot to mention it. I'm now using references to assign to the
internals of an array, no matter how many levels deep it is.
I had intended to solve the Advent of Code puzzles in Toy, but they
don't work without arrays. I wasn't able to enable arrays in time, so
I need to focus on doing things correctly.
The most immediate tasks are marked with 'URGENT', and a lot of tests
need writing.
I was sidetracked by a strange display bug - turns out it was caused by
pointers - this commit fixes it.
The tests for if-then-else still aren't finished, but I'm knocking off
as it's past my time limit. I've marked 'TODO' and 'URGENT' using
comments, so finding the issues should be easy.