3 ms·
We used runtime assertions both as executable documentation and to avoid system corrution by failing on any false. Since you can't just stop a critical system w
by devjab 2y ago
We used runtime assertions both as executable documentation and to avoid system corrution by failing on any false. Since you can't just stop a critical system we would use triple modular redundancy ultimately leading to devices running in a "safe state". If this happened you would need to get your device recalibrated but you wouldn't die.
Base64 would require dynmaic memory, you would likely use a packed struct. How you would do it depends on your compiler, but we would use #pragma.
- boomlinde 2y agoYou can parse and encode JSON without dynamic memory allocation. You can encode base64 without dynamic memory allocation, and you can even decode it in-place. You just need to know the appropriate buffer sizes for a valid payload. For base64 this is a trivial function of the input size. For a streaming decoder you don't even need more than a fixed few bytes of state. I am not arguing that either of these are appropriate for your application, particularly not base64, which doesn't address the basic problem of representing structured data, but it isn't true that they require dynamic allocation, which is good to keep in mind if you ever find yourself in need of these encoding schemes in a resource constrained system.