2 ms·
It isn't designed to be small; it's designed to be a fully featured string formatting library with size as an important secondary goal. If you want something t
by IshKebab 2y ago
It isn't designed to be small; it's designed to be a fully featured string formatting library with size as an important secondary goal.
If you want something that has to be microscopic at the cost of not supporting basic features there are definitely better options.
> I can assure you that when writing code for microcontrollers with 2 kilobytes of code space, we don't include a 14 kilobyte string formatting library...
No shit. If you only have 2kB (unlikely these days) don't use this. Fortunately the vast majority of modern microcontrollers have way more than that. E.g. esp32 starts at 1MB. Perfectly reasonable to use a 14kB formatting library there.
- londons_explore 2y agoWhen you're designing something that sells for a dollar to retailers, eg. a birthday card that sings, your boss won't let you spend more than about 5 cents on the microcontroller, and probably wants you to spend 1-2 cents if you can.
- swagonomixxx 2y agoI kind of get where you're coming from but at what point do we admit that such use cases are the fringe and not the main?
- deleted 2y ago[deleted]
- edflsafoiewq 2y agoPerhaps a singing birthday card doesn't need to format strings.
- IshKebab 2y agoSure, but such extreme use cases are rare and don't need to be constantly brought up.
- tialaramex 2y ago> When you're designing something that sells for a dollar to retailers Then you shouldn't prioritize compatibility with 1980s Unix code, which is what C++ is for.
- Narishma 2y ago> esp32 starts at 1MB Which models? The most I've ever seen on an ESP32 is 512KB of SRAM.
- ta988 2y agoI think they are talking about the flash. The code is by default run from flash (a mechanism called XIP execute in place). But you can annotate functions (with a macro called IRAM_ATTR) that you want to have in ram if you need performance (you have to also be careful about the data types you use inside as they are not guaranteed to be put in RAM).