3 ms·
I promise this is not intended as snark: if you already have .php files used for the build, why then do string and memory management in C?
by mdaniel 2y ago
I promise this is not intended as snark: if you already have .php files used for the build, why then do string and memory management in C?
- bilekas 2y agoI don't know for sure, but I would hazard a guess that it would take up less space, if memory serves, I don't think PHP has pointers for example and I guess things like that would be more space efficient in c.
- chuckadams 2y agoPHP has a pack() function that can write arbitrary bits, and if you like things extra-gnarly, you can manipulate arbitrary structs (and pointers) with FFI. But if there’s already a parser in C, it makes sense to use it.
- phoboslab 2y agoI assume you're talking about the pack_map.c used during build? That just was written in C because I had the .map parser already lying around from another side project. If I had done it from scratch for this project it likely would have been JS or PHP, too.