Better HN
topnewbestaskshowjobs
Log inSign up

krinkatt

1 karma · joined Apr 13, 2023 (3y ago) · 2 submissions

Submissions

comment 3y ago · link · parent

I have something like this that serves me well:

  struct strbuf { size_t cap, len; char *str; };
  void sb_setf(struct allocator *a, struct strbuf *sb, const char *fmt, ...);
  void sb_appendf(struct allocator *a, struct strbuf *sb, const char *fmt, ...);
  // have other convenience functions for formatting fixed point values like "prefix AAA.BBB suffix" ("voltage: 7.23 V")
  // special helpers for dates, times, etc.
Just keep building that library up and you'll have growable buffer, strings, lists, hashmap (uintptr -> uintptr is all you need in 99% of cases I've found, maybe some helper functions for string key -> void * built ontop of uintptr->uintptr) + replace/rewrite the standard library to operate on these types instead and you're good to go.

comment 3y ago · link · parent

Searching *.exe in Everyting and select all -> 12 779 objects.

With 50MB a piece that would be ~0.5TB. That is 50% of my system SSD.