Notes for uc_tools lib FIXME: Many posts could be moved here. Entry: NS Date: Mon Jan 13 19:21:56 CET 2020 #undef NS is not a good idea, because that kills compositionality. Always do it at the "caller" end. Entry: Pointers are expensive Date: Mon Jan 13 22:16:13 CET 2020 Linked data structures easily ramp up memory usage on 32-bit systems. Some ways to mitigate: - use indices into arrays, globally known, or known in context - same but implicitly in the memory hierarchy. e.g. take into account limited memory size, start of RAM, and alignment. e.g. a 16-bit pointer can address 256k if memory is aligned. Of course binding to the memory layout is bad for portability. So indices seem best. Entry: Procedural static allocation Date: Mon Jan 13 22:41:01 CET 2020 It is still possible to procedurally allocate data in case manual allocation would be cumbersome. Do the same as malloc(), only use a bump allocator for a flat piece of memory. If the data usage is predictable, it can be computed by just running the code until allocation succeeds. Entry: Rust inspired static alloc Date: Sat Jan 18 21:56:47 CET 2020 I'm surprised that many things can be done without the need for static alloc.