Formatting strings
Yesterday I implemented string formatting on my printf. I thought the string formatting was gonna take longer, but it was way easier than handling ints: The precision just delimits how many characters you print, and there are far less flag combinations to worry about.
It’s now passing 95% of tests. The ones that aren’t passing are mostly due to differences between the MacOS and Linux implementations of printf.
I’m currently debugging it in a MacOS environment through ssh, and I’m learning how to use debug tools from the command line.
Today I’ll clean up all the bugs, extract all the new libft functions I wrote and separate libft from ft_printf (right now they’re all in a single directory, header file and Makefile).
I’m pretty sure I’ll start the evaluations today. After I’m done with the project I’ll add printf and get_next_line to my libft.
I’m proud of all the utility functions I wrote during the project, dealing with different types and reducing the complexity of freeing variables. Surprisingly, I ended up implementing printf without a single heap allocation, which simplifies a lot of stuff and makes it run super fast.
My greatest obstacle is debugging it from the shell, but it’s helping me git gud at Emacs and GDB; I hate vim and I’m never gonna use that thing.