Re:A Modern Web App in C
by prophittcorey on Monday October 12, 2026 @01:03PM
(#50059359)
To be fair, the HTML and CSS in C wasn't too bad.. the Youtube scraper was also written in C and that was a lot more painful :)
I can empathize entirely. After writing a scraper for html in C, outputting html in C is a piece of cake.
Re:A Modern Web App in C
by PhilipRoman on Monday October 12, 2026 @01:18PM
(#50059594)
Emitting strings is fine, it's the parsing that sucks.
Of course, you could spend half an hour to write a string abstraction first before writing the parser, and which case this is not a problem anymore.
If you do it with the string functions from the standard library then yes, it is.
Re:A Modern Web App in C
by prophittcorey on Monday October 12, 2026 @01:15PM
(#50059540)
The standard string functionality is painful. I wrote my own string view and string builder that work with fixed size strings. No memory allocations, etc.
tell me where working with strings is not miserable?
Practically, modern languages with RAII make it easy at the cost of perfomance (doing a lot of allocations).
So, if you doing lot of string handling, you still need to think how to do it in performant way. If doing it a bit - why care about miserable.
Re:A Modern Web App in C
by jiggawatts on Tuesday October 13, 2026 @12:23AM
(#50066698)
You can "have your cake and eat it too" in Rust, C#, and I suppose C++ if you're a masochist.
These modern languages have both easy-to-use "owning" string types and a "string slice" type that can be passed around efficiently. Unlike C, in these languages a string and a slice are largely interchangeable, which makes them easier to use throughout not just your own codebase, but third-party libraries too.
For example, the Rust `httparse` crate `Request` type returns parsed fields as string slices, not strings, which means it doesn't allocate anything on the heap: https://docs.rs/httparse/latest/httparse/struct.Request.html
Um, any and all string handling in C is pretty miserable.