munificent / craftinginterpreters

Repository for the book "Crafting Interpreters"
http://www.craftinginterpreters.com/
Other
8.79k stars 1.03k forks source link

Fix GROW_ARRAY argument order in Ch14 Challenge 1 solution #948

Closed sarckk closed 3 years ago

sarckk commented 3 years ago

The order of arguments for GROW_ARRAY in the example solution for Ch14 Challenge 1 (run-length encoding) is wrong. type should come before the pointer parameter as per the macro definition:

#define GROW_ARRAY(type, pointer, oldCount, newCount) \
    (type*)reallocate(pointer, sizeof(type) * (oldCount), \
        sizeof(type) * (newCount))
munificent commented 3 years ago

Thank you!